SOAP WSDL service fetch methods and their parameters RRS feed

  • Question

  • I want to fetch methods and their parameters from WSDL service, i have a url : So far what i found is

    XDocument doc = XDocument.Parse(new WebClient().DownloadString(""));
        XNamespace wsdl = "";
        XNamespace s = "";
        var schema = doc.Root
            .Element(wsdl + "types")
            .Element(s + "schema");
        var elements = schema.Elements(s + "element");
        Func<XElement, string> getName = (el) => el.Attribute("name").Value;
        // these are all method names
        var names = from el in elements
                    let name = getName(el)
                    where !name.EndsWith("Response")
                    select name;
        string methodName = "UpdatePatient";
        var method = elements
            .Single(el => getName(el) == methodName);
        // these are all parameters for a given method
        var parameters = from par in method.Descendants(s + "element")
                         select getName(par);

    This gives me all methods which is good , and parameters also , but the problem is parameters may be of complex type . And i need it to be SOAP request xml For examples : IF you go to this url and use the above url It gives you list of method and upon clicking them gives me request xml and using this request xml i can initiate a call to that method . I am trying to the same thing 

    Wednesday, October 19, 2016 12:08 PM

All replies

  • Hi Vaseem,

    What is your service type? Based on your description, it seems you want to generate help page. If you are using wcf web service or web api, I would suggest you try the built-in help page function. You could refer the link below:

    # WCF Web HTTP Service Help Page

    # Creating Help Pages for ASP.NET Web API

    If you are not able to control the service and you only have wsdl, there is no built-in library to achieve your requirement, you will need to loop through the wsdl file to get the complex type. For Soap request xml, I would suggest you call from your client and capture the request by Fiddler to get the real request, save the request to local file, and then generate the help page.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, October 21, 2016 3:25 AM