SOAP

From DataFlex Wiki
Revision as of 15:23, 22 November 2007 by Mikepeat (talk | contribs) (Adding)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

SOAP is a XML-based protocol for exchanging data over a network. It used to stand for Simple Object Access Protocol, but since it was not all that simple and not in any meaningful way object oriented it has been, by consensus, retrospectively stripped of its acronym status. It is often proposed that it should now stand for Service Oriented Architecture Protocol, however this is only a little better, as Service Oriented Architectures require many other protocols than SOAP, and indeed can be built entirely without it.

SOAP is the basis of Web Services within Visual DataFlex.

A SOAP message is composed of an outer element, the Envelope, which then contains an optional Header element and a required Body element. Many simple SOAP services make no use of the Header element, but it is required for most of the more advanced web service protocols.

An example of a SOAP message might be (from [1]):

<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
 <env:Header>
  <n:alertcontrol xmlns:n="http://example.org/alertcontrol">
   <n:priority>1</n:priority>
   <n:expires>2001-06-22T14:00:00-05:00</n:expires>
  </n:alertcontrol>
 </env:Header>
 <env:Body>
  <m:alert xmlns:m="http://example.org/alert">
   <m:msg>Pick up Mary at school at 2pm</m:msg>
  </m:alert>
 </env:Body>
</env:Envelope>

In addition to the three elements mentioned above, SOAP defines a Fault element, which will appear within the response Body, with additional sub-elements, for returning failure information from the server (from [2]):

<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
              xmlns:m="http://www.example.org/timeouts"
              xmlns:xml="http://www.w3.org/XML/1998/namespace">
<env:Body>
  <env:Fault>
   <env:Code>
     <env:Value>env:Sender</env:Value>
     <env:Subcode>
      <env:Value>m:MessageTimeout</env:Value>
     </env:Subcode>
   </env:Code>
   <env:Reason>
     <env:Text xml:lang="en">Sender Timeout</env:Text>
   </env:Reason>
   <env:Detail>
     <m:MaxTime>P5M</m:MaxTime>
   </env:Detail>    
  </env:Fault>
 </env:Body>
</env:Envelope>