The Sysadmin Notebook  

Sitemap

SOAP 1.2

Simple Open Access Protocol

The SOAP recommendation defines a protocol to exchange information using XML via RPC. A SOAP message consists of an Envelope element that contains a Header and a Body elements. The basic structure is as follows:

<?xml version='1.0' ?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> 
 <env:Header>
  <m:reservation xmlns:m="http://travelcompany.example.org/reservation" 
          env:role="http://www.w3.org/2003/05/soap-envelope/role/next"
           env:mustUnderstand="true">
   <m:reference>uuid:093a2da1-q345-739r-ba5d-pqff98fe8j7d</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>Ake Jogvan Oyvind</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>

Envelope

Top Bottom

The SOAP <env:Envelope> element provides the root element for the document and can also be used to provide any namespace declarations.

Header

Top Bottom

The optional <env:Header> element can be used to specify control information not considered part of the data payload. The direct child elements of the <Header> element can be group as 'header blocks' which can be targeted at specific SOAP nodes (SOAP intermediaries) along the SOAP message path to the ultimate SOAP receiver node. In the example above, the two header blocks specify a 'role' of 'next', and a 'mustUnderstand' value of 'true' which indicates the next node in the SOAP message path must handle these header blocks. The other values for 'role' are: ultimateReceiver or none. Intermediary nodes must remove header blocks unless the 'relay' value is set to 'true'.

Body

Top Bottom

The <env:Body> element contains the actual data intended for the ultimate SOAP receiver node. All direct child elements of the Body element must reside in a seperate namespace from the SOAP namespace.