Web service

 
 
Web services are web based applications that use open, XML-based standards and transport protocol designed to support interoperable machine-to-machine interaction over a network.

rss feed






Explain SOAP version 1.2



The Simple Object Access Protocol (SOAP), is a protocol specification for exchanging structured information in the implementation of web services.

More information about the SOAP specification, see http://www.w3.org/TR/soap/



Information

Example SOAP 1.2 message
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?xml version="1.0"?>
<soap:Envelope
   xmlns:soap="http://www.w3.org/2003/05/soap-envelope/"
   soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
   xmlns:t="http://www.mobilefish.com/ws/timeouts"

   <soap:Header>
      <n:alertcontrol xmlns:n="http://www.mobilefish.com/ws/ac">
         <n:priority>1</n:priority>
         <n:expires>2001-06-22T14:00:00-05:00</n:expires>
      </n:alertcontrol>
      <m:transaction xmlns:m="http://www.mobilefish.com/ws/tx" soap:mustUnderstand="true">
         46
      </m:transaction>
   </soap:Header>

   <soap:Body>
      <article xmlns="http://www.mobilefish.com/ws/catalogue">
         <name>Soapbox</name>
         <url>http://www.mobilefish.com/demo</url>
      </article>
      <soap:Fault>
         <soap:Code>
            <soap:Value>soap:Sender</soap:Value>
            <soap:Subcode>
               <soap:Value>t:MessageTimeout</soap:Value>
            </soap:Subcode>
         </soap:Code>
         <soap:Reason>
            <soap:Text xml:lang="en">Sender Timeout</soap:Text>
         </soap:Reason>
         <soap:Detail>
            <t:MaxTime>P5M</t:MaxTime>
         </soap:Detail>
      </soap:Fault>
   </soap:Body>

</soap:Envelope>




# Description
02 The Envelope (mandatory) is the root element of the SOAP message.
03 The xmlns:soap namespace should always have the value of: "http://www.w3.org/2003/05/soap-envelope/,
and defines the Envelope as a SOAP Envelope. If a different or no namespace is used, the application generates an error and discards the SOAP message.

Note: The choice of any namespace prefix "xmlns:soap" is arbitrary and not semantically significant.
04 The Envelope element may have the following attribute and defines how a recipient should process the SOAP message.
  • encodingStyle (See Header element for explanantion)
07 The Header element (optional) is encoded as the first immediate child element of the Envelope element and contains application specific information (like authentication, payment, etc) about the SOAP message.

The Header element may have the following attributes:
  • encodingStyle
    The encodingStyle attribute defines the data types in the SOAP message which can be used to serialize or deserialize the SOAP message. A SOAP message has no default encoding.
  • role
    Is used to indicate the SOAP node to which a particular SOAP header block is targeted
  • mustUnderstand
    Is used to indicate whether the processing of a SOAP header block is mandatory or optional and has the value of "false" or "0", "true" or "1". If this attribute is omitted, mustUnderstand is considered "false".
  • relay
    Is used to indicate whether a SOAP header block targeted at a SOAP receiver must be relayed if not processed and has the value of "false" or "0", "true" or "1". If this attribute is omitted, relay is considered "false".
08 All immediate child elements of the Header element must be namespace qualified, for example: xmlns:n="http://www.mobilefish.com/ws/ac"
xmlns:t="http://www.mobilefish.com/ws/tx"
17 The Body element (mandatory) contains information intended for the ultimate recipient of the message.

Immediate child elements of the SOAP Body element should be namespace-qualified.
22 The Fault element (optional) is used to carry error information within a SOAP message. If present, the SOAP Fault element MUST appear as a body entry and MUST NOT appear more than once within a Body element. The Fault element has two or more child elements in order as follows:
  • Code (mandatory)
    The Code element contains two elements:
    • Value (mandatory)
      SOAP defines a small set of SOAP fault codes covering high level SOAP faults:
      • VersionMismatch
        Found an invalid namespace for the SOAP Envelope element.
      • MustUnderstand
        An immediate child element of the Header element, with the mustUnderstand attribute set to "1", was not understood.
      • DataEncodingUnknown
        A SOAP header block or SOAP body child element information item targeted at the faulting SOAP node is scoped with a data encoding that the faulting node does not support.
      • Sender
        The message was incorrectly formed or did not contain the appropriate information in order to succeed. For example, the message could lack the proper authentication or payment information. It is generally an indication that the message is not to be resent without change.
      • Receiver
        The message could not be processed for reasons attributable to the processing of the message rather than to the contents of the message itself. For example, processing could include communicating with an upstream SOAP node, which did not respond. The message could succeed if resent at a later point in time.
    • Subcode (optional)
      The Subcode element contains two elements:
      • Value (mandatory)
        The value of this element is an application defined subcategory of the value of the Value child element information item of the Subcode element information item's parent element information item.
      • Subcode (optional)
  • Reason (mandatory)
    Is intended to provide a human-readable explanation of the fault.
  • Node (optional)
    The Node element information item is intended to provide information about which SOAP node on the SOAP message path caused the fault to happen.
  • Role (optional)
    The Role element information item identifies the role the node was operating in at the point the fault occurred. The value of the Role element information item MUST be one of the roles assumed by the node during processing of the message.
  • Detail (optional)
    The Detail element information item is intended for carrying application specific error information.