8.3 SOAP Encoding


SOAP assumes that many applications based on it will want to send encoded data labeled with its type whether a simple type, such as character string, integer, and floating-point number, or a compound type, such as array and structure. In the case of a remote procedure call (Section 8.5), such data would consist of parameters or results. SOAP is very general, however, and has many other possible uses requiring the transmission, within XML, of typed, encoded data.

8.3.1 The encodingStyle Attribute

The specific encoding detailed in the SOAP specification is not fundamental to SOAP. To indicate how data are encoded, SOAP defines a very general mechanism based on its global encodingStyle attribute, which appears in the

 http://www.w3.org/2001/12/soap-envelope 

namespace. This attribute, which can appear on any data element, specifies the encoding that the content of that element and all descendants use until it is overridden with another encodingStyle attribute. This inheritance resembles the scoping rules for "xml:lang" and the like.

The value of this attribute is not just, as you might guess, one URI, but a list of URIs separated by white space. These URIs are given in order from the most restrictive to the most general. The encoded data are converted to whatever local internal representation is convenient by trying the first encoding and, if the conversion encounters errors because the data do not conform to that encoding, then trying the second encoding, if a second encoding is given, and so on.

The encoding defined in the SOAP specification is assigned the following URI:

 http://www.w3.org/2001/12/soap-encoding 

The specification defines meanings for this URI, the null URI, and extensions of this soap-encoding URI. A null URI represents a disclaimer of any information about the encoding of data; its primary use on an element is to cancel an encodingScope inherited from an ancestor. A URI with the soap-encoding URI as a prefix can only be associated with a narrower encoding defined by restricting the soap encoding.

8.3.2 The http://www.w3.org/2001/12/soap-encoding Encoding

The encoding specified in detail in [SOAP] is very general and powerful, providing complete mechanisms for simple types, structs, arrays, sparse arrays, enumerations, polymorphic accessors, compound types, and so on. The type labels defined in this way can be used in schemas or to directly label elements as to the type of their content. It is beyond the scope of this chapter to give all the intricate details of this process; see [SOAP] for further information. The schema for the encoding defined in the SOAP specification appears in Appendix F.



Secure XML(c) The New Syntax for Signatures and Encryption
Secure XML: The New Syntax for Signatures and Encryption
ISBN: 0201756056
EAN: 2147483647
Year: 2005
Pages: 186

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net