A SOAP message is an ordinary XML document containing the following elements.
- Envelope: ( Mandatory )
Defines the start and the end of the message. - Header: ( Optional )
Contains any optional attributes of the message used in processing the message, either at an intermediary point or at the ultimate end point. - Body: ( Mandatory )
Contains the XML data comprising the message being sent. - Fault: ( Optional )
An optional Fault element that provides information about errors that occurred while processing the message
All these 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 is:
http://www.w3.org/2001/12/soap-encoding
NOTE: All these specifications are subject to change. So keep updating yourself with the latest specifications available W3 website.
Syntax Rules
Here are some important syntax rules:
- A SOAP message MUST be encoded using XML
- A SOAP message MUST use the SOAP Envelope namespace
- A SOAP message MUST use the SOAP Encoding namespace
- A SOAP message must NOT contain a DTD reference
- A SOAP message must NOT contain XML Processing Instructions
A SOAP Message Structure-
<?xml version="1.0"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2001/12/soap-envelope" SOAP-ENV:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> <SOAP-ENV:Header> ... ... </SOAP-ENV:Header> <SOAP-ENV:Body> ... ... <SOAP-ENV:Fault> ... ... </SOAP-ENV:Fault> </SOAP-ENV:Body> </SOAP_ENV:Envelope>
References
1. Wikipedia for SOAP