Networking / Beginners

Simple Object Access Protocol

SOAP was originally named as the Simple Object Access Protocol. It was designed as a lightweight protocol for exchange of XML documents over an underlying transport protocol. It supports transactions on distributed objects in a Web-based environment by defining how remote procedure calls and responses may be represented within messages that may be sent between participating network elements. As SOAP has developed and been extended, its longer name was considered to be somewhat misleading, and so the protocol is now simply known as SOAP.

SOAP messages are encoded in XML, which makes them reasonably easy for a user to read. The whole message is contained in an envelope and comprises an optional header and a mandatory body. The header contains control information about the message (things like priority and destination) and is not always required because in most cases the default behavior can be applied and the assumed destination is the receiver of the message. SOAP does allow messages to be relayed, however. That is, a SOAP message from node A to node C may be sent on a transport connection from node A to node B and relayed by the SOAP component on node B, which sends the message onward on a connection to node C. This feature requires that the header includes the target node for the message. The SOAP body contains the XML operations and data being transferred, as shown in below.

<env:Envelope xmlns:env="http://www.w3.org/2003/05/
  soap-envelope">
    <env:Header>
      <t:transaction xmlns:n="http://example.com/
	example-msg" env:mustUnderstand="true">
    <n:priority>Low</n:priority>
    <n:expires>2005-10-15T23:59:59-05:00</n:expires>
      display
</t:transaction>
</env:Header>
<env:Body>
    <dsp:text>This message is displayed.</dsp:text>
</env:Body>
</env:Envelope>

Example SOAP message carrying a message to be displayed.

The SOAP envelope may alternatively contain a SOAP fault construct. This is used to report errors and has several mandatory components, including an error code for the fault, a text string describing the fault, and the identifier of the reporting node. Shows a sample fault message copied from the SOAP specification.

<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>
[Previous] [Contents] [Next]