0

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

jaySon
  • 795
  • 2
  • 7
  • 20

1 Answers1

0

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.

Matt Ko
  • 969
  • 7
  • 14
  • Well, thank you very much for this! I guess that's what I am looking for. Still I seem to have trouble doing this stuff with JavaScript as there seems to be an issue with CORS and the answers on StackOverflow are not really helpful as they only mention WHAT to do, but now HOW to do it... – jaySon Oct 29 '14 at 09:58
  • In general, you can't invoke a web service from the client-side in Javascript. Unless of course that web service is hosted on the same domain than where you are serving the website from. – Matt Ko Oct 29 '14 at 10:02
  • Instead, you should pass on the command to your server and invoke the web service from there, then pass the results back to your client. In general, this should be enough, but if you really need to, there are certain ways to work around CORS (you'll find more information in other questions here). – Matt Ko Oct 29 '14 at 10:03
  • I have indeed found answers with workarounds for the CORS problem, but none of them gave actual examples. Like I wrote, they all state WHAT, but not HOW. It's probably cristal clear to "JS natives", but to someone like me, who started learning JS just half a year ago, it's still very new stuff. For instance if there is an OPTIONS response by the server to a POST, the answer is to send an OPTION request, wait for the server to answer and then send the POST. But what that actually looks like, no clue: http://stackoverflow.com/questions/5417014/soap-web-service-calls-from-javascript – jaySon Oct 29 '14 at 14:20