How to programatically build a SOAP message from WSDL definition RRS feed

  • Question

  • I'm looking for a way to generate a SOAP request matching a WSDL file programatically.
    I know i can do this easily using a proxy class and that i do not have to worry about the soap level but that is not what i'm looking for.

    Basically i have a WSDL describing a service.
    I want to create a SOAP request for a specific service like this:

    <soapenv:Envelope xmlns:xsi="" xmlns:xsd="" xmlns:soapenv="" xmlns:bas="some namespace ....">
          <bas:themethodname soapenv:encodingStyle="">
             <someList xsi:type="bas:JobIDList">
                <!--1 or more repetitions:-->
                <item xsi:type="xsd:string">hello</item>
         <item xsi:type="xsd:string">Salut</item>
             <senderName xsi:type="xsd:string">Me</senderName>
             <TimeStamp xsi:type="xsd:string">2 pm</TimeStamp>

    Then that soap message may be put on a Message Queue. The client on the other side wil process the message and send the response.
    I then need to parse that response.

    So from the WSDL i get the schemas. Then how to generate the soap request is my question?
    And then how to process the response back?

    Any help would be greatly appreciated


    Friday, April 3, 2015 12:24 PM


  • Check out the documentation for the XmlSchemaElement class.  It has several properties that you can use to look at the element's type and from there get to the sequence "particle" and then the contained element.  You can also see an example of how to do this by looking at the file DefaultWsdlHelpGenerator.aspx, which should be in the same directory as your machine.config file.
    Monday, April 6, 2015 5:59 AM

All replies