|
|
Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs
Page 5 of 6
Listing 9
<SOAP-ENV:Envelope xmlns:SOAP-ENV="
http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:MustUnderstand</faultcode>
<faultstring>SOAP Must Understand
Error</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
The above code resembles the error message in Listing 7. But note that the detail element is absent. As I mentioned before, the SOAP specification states that this element must present itself if the error
occurs while processing the header. In fact, the presence or absence of the detail element can quickly tell you if the error happened while processing the header or the body.
In my first example I sent the custom XML request to the server via HTTP and glossed over what was involved in doing so. Let's come back to that. How can I send a SOAP request (instead of the custom XML) over HTTP to the server? SOAP naturally follows the HTTP request/response message model, which provides SOAP request parameters in an HTTP request and SOAP response parameters in an HTTP response. In fact, SOAP 1.0 specifically designated HTTP as its transport protocol. SOAP 1.1 has loosened up a bit and, although it still works with HTTP, it also works with other protocols such as SMTP. In this series I will only discuss SOAP in the context of using it with HTTP.
Let's go back to the hello example. If we were to send the SOAP request to the server via HTTP it would look similar to the code below:
Listing 10
POST http://www.SmartHello.com/HelloApplication HTTP/1.0
Content-Type: text/xml; charset="utf-8"
Content-Length: 587
SOAPAction: "http://www.SmartHello.com/HelloApplication#sayHelloTo"
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="
http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="
http://www.w3.org/1999/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Header>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns1:sayHelloTo
xmlns:ns1="Hello"
SOAP-ENV:encodingStyle="
http://schemas.xmlsoap.org/soap/encoding/">
<name xsi:type="xsd:string">Tarak</name>
</ns1:sayHelloTo>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Listing 10 features basically the same SOAP request as Listing 4 with some HTTP-specific code at the beginning. The first
line indicates that this is a POST request that conforms to the rules per HTTP 1.1. The target for the post is http://www.SmartHello.com/HelloApplication. The
next line indicates the content type, which must be text/xml when including SOAP entity bodies in HTTP messages. The content
length specifies the payload length of the POST request.
The fourth line is SOAP-specific and mandatory. The SOAPAction HTTP request header field indicates the intent of the SOAP HTTP request. The value is a URI identifying the intent. SOAP
places no restrictions on the format of the URI. In fact, the URI does not even have to be resolvable to an actual location.
One possible use of the SOAPAction field is by a firewall that looks at the field's value and makes a decision on whether to allow the request to pass through.