Team-Fly |
XML, Web Services, and the Data Revolution By Frank P. Coyle | |
Table of Contents | |
Appendix B. SOAP Version 1.2 Part 1: Messaging Framework |
A SOAP message has an XML Infoset that consists of a document information item with exactly one child, which is an element information item as described below. The document element information item has:
4.1 Envelope Encoding and Versioning4.1.1 SOAP encodingStyle AttributeSOAP defines an encodingStyle attribute information item which can be used to indicate the encoding rules used to serialize a SOAP message. The encodingStyle attribute information item has:
It may appear on any element information item in the SOAP message. Its scope is that of its owner element information item and that element information item's descendants, unless a descendant itself owns such an attribute information item. The encodingStyle attribute information item is of type anyURI in the namespace http://www.w3.org/2001/XMLSchema . Its value identifies a set of serialization rules that can be used to deserialize the SOAP message.
The serialization rules defined by SOAP (see [1]SOAP Encoding) are identified by the URI "http://www.w3.org/2001/12/soap-encoding". SOAP messages using this particular serialization SHOULD indicate this using the SOAP encodingStyle attribute information item. In addition, all URIs syntactically beginning with "http://www.w3.org/2001/12/soap-encoding" indicate conformance with the SOAP encoding rules defined in [1](SOAP Encoding), though with potentially tighter rules added. A value of the zero-length URI ("") explicitly indicates that no claims are made for the encoding style of contained elements. This can be used to turn off any claims from containing elements. 4.1.2 Envelope Versioning ModelSOAP does not define a traditional versioning model based on major and minor version numbers . If a SOAP message is received by a SOAP 1.2 node in which the document element information item does NOT have a namespace name of http://www.w3.org/2001/12/soap-envelope the SOAP node MUST treat this as a version error and generate a VersionMismatch SOAP fault (see 4.4 SOAP Fault ). See A Version Transition From SOAP/1.1 to SOAP Version 1.2 for further details. Any other malformation of the message structure MUST be treated as a Sender SOAP fault. 4.2 SOAP HeaderSOAP provides a flexible mechanism for extending a SOAP message in a decentralized and modular way without prior knowledge between the communicating parties. Typical examples of extensions that can be implemented as SOAP header blocks are authentication, transaction management, payment, etc. The Header element information item has:
All child element information items of the SOAP Header are called SOAP header blocks. Each SOAP header block element information item:
4.2.1 Use of Header AttributesThe SOAP header block attribute information items defined in this section determine how a SOAP receiver should process an incoming SOAP message, as described in 2 SOAP Message Exchange Model . A SOAP sender generating a SOAP message SHOULD only use the SOAP header block attribute information items on child element information items of the SOAP Header element information item. A SOAP receiver MUST ignore all SOAP header block attribute information items that are applied to other descendant element information items of the SOAP Header element information item.
SOAP header block attribute information items MUST appear in the SOAP message itself in order to be effective; default values which may be specified in an XML Schema or other description language do not affect SOAP processing (see 3 Relation to XML ). 4.2.2 SOAP actor AttributeAs described in 2 SOAP Message Exchange Model , not all parts of a SOAP message may be intended for the ultimate SOAP receiver. The actor attribute information item is to be used to indicate the SOAP node at which a particular SOAP header block is targeted . The actor attribute information item has the following Infoset properties:
The type of the actor attribute information item is anyURI in the namespace http://www.w3.org/2001/XMLSchema. The value of the actor attribute information item is a URI that names a role that a SOAP node may assume. Omitting the SOAP actor attribute information item implicitly targets the SOAP header block at the ultimate SOAP receiver. An empty value for this attribute is equivalent to omitting the attribute completely, i.e. targeting the block at the ultimate SOAP recipient. 4.2.3 SOAP mustUnderstand AttributeAs described in 2.4 Understanding SOAP Headers , the SOAP mustUnderstand attribute information item is used to indicate whether the processing of a SOAP header block is mandatory or optional at the target SOAP node. The mustUnderstand attribute information item has the following Infoset properties:
The type of the mustUnderstand attribute information item is boolean in the namespace http://www.w3.org/2001/XMLSchema. Omitting this attribute information item is defined as being semantically equivalent to including it with a value of "false". 4.3 SOAP BodyThe SOAP Body element information item provides a simple mechanism for exchanging mandatory information intended for the ultimate SOAP receiver of a SOAP message. Example uses of SOAP Body include marshalling RPC calls and error reporting. The Body element information item has:
All child element information items of the SOAP Body element information item:
SOAP defines one particular direct child of the SOAP body, the SOAP fault, which is used for reporting errors (see 4.4 SOAP Fault ). 4.4 SOAP FaultThe SOAP Fault element information item is used to carry error and/or status information within a SOAP message. If present, the SOAP Fault MUST appear as a direct child of the SOAP body and MUST NOT appear more than once within a SOAP Body. The Fault element information item has:
4.4.1 SOAP faultcode ElementThe faultcode element information item has:
The type of the faultcode element information item is QName in the http://www.w3.org/2001/XMLSchema namespace. It is intended for use by software to provide an algorithmic mechanism for identifying the fault. SOAP defines a small set of SOAP fault codes covering basic SOAP faults (see 4.4.5 SOAP Fault Codes ) 4.4.2 SOAP faultstring ElementThe faultstring element information item has:
The type of the faultstring element information item is string in the http://www.w3.org/2001/XMLSchema namespace. It is intended to provide a human readable explanation of the fault and is not intended for algorithmic processing. This element information item is similar to the 'Reason-Phrase' defined by HTTP[2] and SHOULD provide at least some information explaining the nature of the fault. 4.4.3 SOAP faultactor ElementThe faultactor element information item has:
The type of the faultactor element information item is anyURI in the http://www.w3.org/2001/XMLSchema namespace. It is intended to provide information about which SOAP node on the SOAP message path caused the fault to happen (see 2 SOAP Message Exchange Model ). It is similar to the SOAP actor attribute information item (see 4.2.2 SOAP actor Attribute ) but instead of indicating the target of a SOAP header block, it indicates the source of the fault. The value of the faultactor element information item identifies the source of the fault. SOAP nodes that do not act as the ultimate SOAP receiver MUST include this element information item The ultimate SOAP receiver MAY include this element information item to indicate explicitly that it generated the fault. 4.4.4 SOAP detail ElementThe detail element information item has:
The detail element information item is intended for carrying application specific error information related to the SOAP Body . It MUST be present when the contents of the SOAP Body could not be processed successfully. It MUST NOT be used to carry error information about any SOAP header blocks. Detailed error information for SOAP header blocks MUST be carried within the SOAP header blocks themselves . The absence of the detail element information item indicates that a SOAP Fault is not related to the processing of the SOAP Body . This can be used to find out whether the SOAP Body was at least partially processed by the ultimate SOAP receiver before the fault occurred, or not. All child element information items of the detail element Information Item are called detail entries. Each such element information item:
The SOAP encodingStyle attribute information item is used to indicate the encoding style used for the detail entries (see 4.1.1 SOAP encodingStyle Attribute ). 4.4.5 SOAP Fault Codes
SOAP faultcode values are XML qualified names [7]. The faultcodes defined in this section MUST be used as values for the SOAP faultcode element information item when describing faults defined by SOAP 1.2 Part 1 (this document). The namespace identifier for these SOAP faultcode values is "http://www.w3.org/2001/12/soap-envelope". Other specifications may define their own fault codes. Use of this namespace is recommended (but not required) in the specification of such faultcodes. The faultcode values defined by this specification are listed in the following table.
4.4.6 MustUnderstand FaultsWhen a SOAP node generates a MustUnderstand fault, it SHOULD provide, in the generated fault message, header blocks as described below which detail the qualified names (QNames, per the XML Schema Datatypes specification[5]) of the particular header block(s) which were not understood. Each such header block element information item has:
The qname attribute information item has the following Infoset properties:
The type of the qname attribute information item is QName in the http://www.w3.org/2001/XMLSchema namespace. Its value is the QName of a header block which the faulting node failed to understand. Consider the following message:
The above message would result in the fault message shown below if the recipient of the initial message does not understand the two header elements abc:Extension1 and def:Extension2 . Note that when serializing the qname attribute information item there must be an in-scope namespace declaration for the namespace name of the misunderstood header and the value of the attribute information item must use the prefix of such a namespace declaration. Note also that there is no guarantee that each MustUnderstand error contains ALL misunderstood header QNames. SOAP nodes MAY generate a fault after the first header block that causes an error containing details about that single header block only, alternatively SOAP nodes MAY generate a combined fault detailing all of the MustUnderstand problems at once.
|
Team-Fly |
Top |