예제 #1
0
        public IActionResult GetArtifactsFormUrl([FromBody] IbmUrlModel model)
        {
            string xml;
            List <JazzArtifact> nodesInXml = null;

            using (WebClient client = new WebClient())
            {
                ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
                String username = model.Name;
                String password = model.Password;
                String encoded  = System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(username + ":" + password));
                client.Headers.Add("Authorization", "Basic " + encoded);
                xml = client.DownloadString(model.Url);

                nodesInXml = XmlParser.CreateJazzObjects(xml);
                SaveArtifactToDatabase(nodesInXml, model);
            }
            return(Ok());
        }