Example #1
0
    /// <summary>
    /// Gets a list of WSDL files from a delimited string.
    /// </summary>
    /// <param name="value">The files to load.</param>
    /// <param name="username">The username to use for authentication.</param>
    /// <param name="password">The password to use for authentication.</param>
    /// <param name="domain">The domain to use for authentication.</param>
    /// <returns>Returns a list of WSDL files from a delimited string.</returns>
    public static List <WsdlFile> FromString(string value, string username, string password, string domain)
    {
        List <WsdlFile> list = new List <WsdlFile>();

        foreach (string item in value.Split((";\n\t,|").ToCharArray()))
        {
            string path = item;
            path = path.Trim((" \r\n\t").ToCharArray());
            if (String.IsNullOrEmpty(path))
            {
                continue;
            }
            XmlDocument wsdlDocument = GetXmlDocumentFromUrl(path, username, password, domain);
            if (wsdlDocument == null || wsdlDocument.DocumentElement.Name.Contains("definitions") == false)
            {
                path         = path + "?WSDL";
                wsdlDocument = GetXmlDocumentFromUrl(path, username, password, domain);
            }
            string imports = null;
            if (wsdlDocument == null || wsdlDocument.DocumentElement.Name.Contains("definitions") == false)
            {
                wsdlDocument = null;
                imports      = GetStringFromUrl(item, username, password, domain);
            }
            if (String.IsNullOrEmpty(imports) == false)
            {
                foreach (WsdlFile file in FromString(imports, username, password, domain))
                {
                    list.Add(file);
                }
            }
            else
            {
                if (wsdlDocument != null)
                {
                    WsdlFile file = new WsdlFile();
                    file.Path     = path;
                    file.Document = wsdlDocument;
                    ExpandImports(file.Document);
                    list.Add(file);
                }
            }
        }
        return(list);
    }
Example #2
0
 /// <summary>
 /// Gets a list of WSDL files from a delimited string.
 /// </summary>
 /// <param name="value">The files to load.</param>
 /// <param name="username">The username to use for authentication.</param>
 /// <param name="password">The password to use for authentication.</param>
 /// <param name="domain">The domain to use for authentication.</param>
 /// <returns>Returns a list of WSDL files from a delimited string.</returns>
 public static List<WsdlFile> FromString(string value, string username, string password, string domain)
 {
     List<WsdlFile> list = new List<WsdlFile>();
     foreach (string item in value.Split((";\n\t,|").ToCharArray())) {
         string path = item;
         path = path.Trim((" \r\n\t").ToCharArray());
         if (String.IsNullOrEmpty(path)) { continue; }
         XmlDocument wsdlDocument = GetXmlDocumentFromUrl(path, username, password, domain);
         if (wsdlDocument == null || wsdlDocument.DocumentElement.Name.Contains("definitions") == false) {
             path = path + "?WSDL";
             wsdlDocument = GetXmlDocumentFromUrl(path, username, password, domain);
         }
         string imports = null;
         if (wsdlDocument == null || wsdlDocument.DocumentElement.Name.Contains("definitions") == false) {
             wsdlDocument = null;
             imports = GetStringFromUrl(item, username, password, domain);
         }
         if (String.IsNullOrEmpty(imports) == false) {
             foreach (WsdlFile file in FromString(imports, username, password, domain)) {
                 list.Add(file);
             }
         } else {
             if(wsdlDocument != null) {
                 WsdlFile file = new WsdlFile();
                 file.Path = path;
                 file.Document = wsdlDocument;
                 ExpandImports(file.Document);
                 list.Add(file);
             }
         }
     }
     return list;
 }
Example #3
0
 /// <summary>
 /// Converts the WSDL file to a package XML document.
 /// </summary>
 /// <param name="file">The <see cref="WsdlFile"/> to be converted.</param>
 /// <returns>Returns the package XML file.</returns>
 public XmlDocument ConvertToPackage(WsdlFile file)
 {
     errors = new List <string>();
     return(this.Transform(file.Document));
 }
Example #4
0
 /// <summary>
 /// Converts the WSDL file to a package XML document.
 /// </summary>
 /// <param name="file">The <see cref="WsdlFile"/> to be converted.</param>
 /// <returns>Returns the package XML file.</returns>
 public XmlDocument ConvertToPackage(WsdlFile file)
 {
     errors = new List<string>();
     return this.Transform(file.Document);
 }