As we touched upon earlier, SOAP is used to send a message to a Web service and get a response. It employs XML to provide the layer of system independence Web services hope to achieve, defining a way to express URLs and parameters that can be mapped into system-dependent variables by both the caller and the service.
The header for a SOAP message bound to HTTP looks just like any other HTTP post header with a content-type of text/XML. The body of the post message holds the "SOAP Envelope," which contains the request to the service. This consists of an optional header, any name spaces to use, and the actual call with parameters, all in plain-text XML. The response is set up exactly the same way, but the results of the service with your parameters are the contents of the message (see "Example of Client SOAP Message Over HTTP" below).
Note how the (simplified) example is structured. The normal HTTP headers are present, followed by the SOAP Envelope version, the SOAP Encoding Style and the SOAP body--our area of interest. Our Web Service has an entry point defined at www.Someplace.org/GetSomeValues. This entry point takes a single string as input--we sent "test input" as the string with the XML tag paramOne.
The server processes the request and sends the following response shown in "Example of Server Response." Note again the normal HTTP header. For a "200 OK" message, the content length--if present--must be exact according to the SOAP spec. This is in line with HTTP 1.1 standards but could cause problems on some HTTP 1.0 servers. The normal content type header says "text/XML," the SOAP header includes encoding information for both the message and the header, and the SOAP body is where the "payload" is. The routine is "getSomeValueResponse," and the ResponseText is in the "Result" tag.