Search code examples
xmlweb-servicespostsoapwsdl

Why is the SOAP envelope such a mystery?


There are many examples on the web describing what a SOAP envelope should look like. W3Schools has this example:

<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

<soap:Body>
  <m:GetPrice xmlns:m="http://www.w3schools.com/prices">
    <m:Item>Apples</m:Item>
  </m:GetPrice>
</soap:Body>

</soap:Envelope>

But where do I know from that I have to use "GetPrice" and "Item" (in this example)? Where is this data defined? Is it a WSDL file I - as client developer - can look into?

I'd really like to have a working example of a SOAP request and response as all those I found so far (on the web and StackOverflow) are either depricated hence unusable or with example code like this.

Regards, jaySon


Solution

  • This web service here is really well made: http://www.w3schools.com/webservices/tempconvert.asmx

    You can go to the Service Definition and look into the WSDL, where the service operations and data contracts are defined.

    You can also go to the different operations and look into sample requests/invoke the service yourself.