SOAP Web Service Tutorials - Herong's Tutorial Examples - v5.13, by Herong Yang
SOAP Generic Message Structure
This section provides a description of the SOAP generic message structure and a sample message.
A SOAP message is an XML document with "Envelope" as the root element with the following structure:
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> ... </env:Header> <env:Body> ... </env:Body> </env:Envelope>
where "Header" is an optional child element, and "Body" is a required child element.
A "Header" element may contain zero or more "Header Block" elements with the following structure:
<env:Header> <hb0:headBlock0 xmlns:hb0="Uri0"> ... </hb0:headBlock0> ... <hbN:headBlockN xmlns:hbN="UriN"> ... </hbN:headBlockN> </env:Header>
A "Header Block" element must have a name space. It may contain text information and any number of child elements. It may also contain any number of attributes including SOAP predefined attributes. A "Header Block" has the following structure:
<hb:headBlock xmlns:hb="Uri"> <hb:child0 encodingStyle="..." role="..." mustUnderstand="..." relay="..." ...> ... </hb:child0> ... (text) ... <hb:childN encodingStyle="..." role="..." mustUnderstand="..." relay="..." ...> ... </hb:childN> </hb:headBlock>
"encodingStyle", "role", "mustUnderstand" and "relay" are SOAP predefined attributes. We will discuss them later.
A "Body" element has almost no restrictions. It may have text information, any number of attributes and any number of child elements, with the following structure:
<env:Body ...> <bodyChild0 ...> ... </bodyChild0 ...> ... (text) ... <bodyChildN ...> ... </bodyChildN ...> </env:Body>
To give an idea of how a SOAP message looks like, I have copied the example #1 from the SOAP 1.2 specification here:
<?xml version="1.0"?> <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> <m:reservation xmlns:m="http://travel.example.org/reservation" env:role="http://www.w3.org/2003/05/soap-envelope/role/next" env:mustUnderstand="true"> <m:reference>uuid:093a2da1-q345-73pqff98fe8j7d</m:reference> <m:dateAndTime>2001-11-29T13:20:00.000-05:00</m:dateAndTime> </m:reservation> <n:passenger xmlns:n="http://mycompany.example.com/employees" env:role="http://www.w3.org/2003/05/soap-envelope/role/next" env:mustUnderstand="true"> <n:name>Herong Yang</n:name> </n:passenger> </env:Header> <env:Body> <p:itinerary xmlns:p="http://travelcompany.example.org/reservation/travel"> <p:departure> <p:departing>New York</p:departing> <p:arriving>Los Angeles</p:arriving> <p:departureDate>2001-12-14</p:departureDate> <p:departureTime>late afternoon</p:departureTime> <p:seatPreference>aisle</p:seatPreference> </p:departure> <p:return> <p:departing>Los Angeles</p:departing> <p:arriving>New York</p:arriving> <p:departureDate>2001-12-20</p:departureDate> <p:departureTime>mid-morning</p:departureTime> <p:seatPreference/> </p:return> </p:itinerary> <q:lodging xmlns:q="http://travelcompany.example.org/reservation/hotels"> <q:preference>none</q:preference> </q:lodging> </env:Body> </env:Envelope>
Table of Contents
Introduction to SOAP (Simple Object Access Protocol)
►SOAP Generic Message Structure
SOAP Message Transmission and Processing
SOAP MEP (Message Exchange Patterns)
PHP SOAP Extension Client Programs
PHP SOAP Extension Server Programs
PHP SOAP Web Service Example - getTemp
Perl SOAP::Lite - SOAP Server-Client Communication Module
Perl Socket Test Program for HTTP and SOAP
Perl SOAP::Lite for NumberToWords SOAP 1.1 Web Service
Perl SOAP::Lite for SOAP 1.2 Web Services
Java Socket and HttpURLConnection for SOAP
SAAJ - SOAP with Attachments API for Java
SoapUI - SOAP Web Service Testing Tool
WS-Security - SOAP Message Security Extension
WS-Security X.509 Certificate Token
Perl SOAP::Lite for GetSpeech SOAP 1.1 Web Service
Perl SOAP::Lite 0.710 for SOAP 1.2 Web Services
Perl SOAP::Lite 0.710 for WSDL