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
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:
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.