can contain multiple header blocks. Header blocks are
targeted to specific SOAP receiver nodes. If a SOAP
message contains a header, it must come before the body
element. The SOAP body contains the actual message
that is designated for the SOAP receiver. Every SOAP
envelope must contain at least one body element.
Typically, SOAP messages are automatically generated
by the web service when it’s called by the client. Figure 6-
7 illustrates the high-level communication that occurs
between a client and a server or web service.
Figure 6-7 High-Level SOAP Communication
Another potentially beneficial aspect of SOAP is that
because it primarily uses HTTP, it is efficient in passing
through firewalls without requiring that any additional
ports be allowed or open for the web service traffic to be
permitted. This can save time and reduce some
operational overhead. To reiterate, the benefit of SOAP is
its capability to work between different languages while
using a simple common HTTP and XML structure.
Example 6-4 shows a sample SOAP message that is being
used to leverage an HTTP GET to retrieve the price for
Cisco’s stock, using the ticker symbol CSCO.
Example 6-4 Sample SOAP Message
Click here to view code image
POST /InStock HTTP/1.1
Host: http://www.example.org
Content-Type: application/soap+xml;
charset=utf-8
Content-Length: 299
SOAPAction: "http://www.w3.org/2003/05/soap-
envelope"
<?xml version="1.0"?>