«^»
5.3. Communicating with a Web Service using HTTP POST and SOAP

An example is:

0197: POST /wsud/cs/ServerConvert/Service1.asmx HTTP/1.1
0198: Host: www.a.com
0199: Content-Type: text/xml; charset=utf-8
0200: Content-Length: XXXX
0201: SOAPAction: "http://www.a.com/webservices/ToFahrenheit"
0202: 
0203: <?xml version="1.0" encoding="utf-8"?>
0204: <soap:Envelope 
0205:     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
0206:     xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
0207:     xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
0208:   <soap:Body>
0209:     <ToFahrenheit xmlns="http://www.a.com/webservices/">
0210:       <pCentigrade>0</pCentigrade>
0211:     </ToFahrenheit>
0212:   </soap:Body>
0213: </soap:Envelope>

Hiding in all this detail is the fact that we want to contact a webserver on www.a.com to visit the page at /wsud/cs/ServerConvert/Service1.asmx to execute the ToFahrenheit method with an argument (pCentigrade) of 0.

The reply from the webserver (after the appropriate method has been executed) is likely to be XML coded using SOAP. An example is:

0214: HTTP/1.1 200 OK
0215: Content-Type: text/xml; charset=utf-8
0216: Content-Length: YYYY
0217: 
0218: <?xml version="1.0" encoding="utf-8"?>
0219: <soap:Envelope 
0220:     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
0221:     xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
0222:     xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
0223:   <soap:Body>
0224:     <ToFahrenheitResponse xmlns="http://www.a.com/webservices/">
0225:       <ToFahrenheitResult>32</ToFahrenheitResult>
0226:     </ToFahrenheitResponse>
0227:   </soap:Body>
0228: </soap:Envelope>
Hidden away in all this XML is the fact that the result of the call of the method is the value 32.