SOAP Syntax
SOAP Building Blocks
A SOAP message is an ordinary XML document that contains the following elements:
- Required Envelope element, which identifies this XML document as a SOAP message
- Optional Header element, which contains header information
- Required Body element, which contains all call and response information
- Optional Fault element, which provides information about errors that occurred while processing this message
All of the above elements are declared in the default namespace for the SOAP envelope:
http://www.w3.org/2001/12/soap-envelope
And the default namespace for SOAP encoding and data types:
http://www.w3.org/2001/12/soap-encoding
Syntax Rules
Here are some important syntax rules:
- SOAP messages must be encoded in XML
- SOAP messages must use the SOAP Envelope namespace
- SOAP messages must use the SOAP Encoding namespace
- SOAP messages must not contain DTD references
- SOAP messages must not contain XML processing instructions
Basic Structure of a SOAP Message
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Header>
...
</soap:Header>
<soap:Body>
...
<soap:Fault>
...
</soap:Fault>
</soap:Body>
</soap:Envelope>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Header>
...
</soap:Header>
<soap:Body>
...
<soap:Fault>
...
</soap:Fault>
</soap:Body>
</soap:Envelope>