There are two elements to a SOAP communication - Request and Response. The following flash movie illustrates a simple SOAP messaging between a Client and Server:
The client sends an XML request packet to the server and the server sends an XML response.
A SOAP message (payload) is wrapped inside an HTTP packet and piggy-backed across the network. The following is the SOAP message format:
The message itself consists of three main parts:
The Envelope - The Envelope defines an overall framework for expressing what is in a message, who should deal with it, and whether it is optional or mandatory. The Envelope contains version information and metadata, such as versioning and authentication, important for understanding the request. The SOAP envelope structure is as follows:
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>
<!-- SOAP body goes here -->
</SOAP-ENV:Envelope>
The SOAP envelope is in the XML namespace prescribed by the specification: http://schemas.xmlsoap.org/soap/envelope/.
The envelope must specify how to interpret the SOAP body. This is accomplished with the SOAP-ENV:encodingStyle attribute. The value is a URI indicating a specification for the structure of the body.
Header - The header is an optional element. This header is intended for firewalls and other network infrastructure that are aware of SOAP, especially for filtering and routing purposes. The SOAP Header attributes determine how a recipient of a SOAP message should process the message.
The Body - This contains application-specific data.
A complete SOAP communication consists of two factors: a request and a response. The Client sends a request packet to the server and the server in turn returns a response. Both, request and response, are essentially just an XML representation carried over HTTP.
The following Calculator application demo illustrates the request/response contents.
Click here to see an XML representation of a complete message