Feedback

  • Contents
 

Envelope Section

The envelope is always the outer most element. Everything else in a SOAP message appears inside SOAP-ENV tags. The envelope in Listing 2 is empty—it doesn't contain any header or body tags.

Listing 2: SOAP Envelope Elements

1 <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
2    SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
3 </SOAP-ENV:Envelope>

  1. Line 1 of the envelope refers an external XML namespace ( xmlns) that defines elements and attributes that can appear in the envelope (such as header or body elements).

  2. Namespacesresolve collision issues by associating XML attribute and element names with a specific context, or "namespace". A namespace is an identifier that helps computer programs determine whether identically named elements refer to the same type of data. Using namespaces, a program can determine that a data element named "Grade" in the "Schoolwork" namespace is different from an element called "Grade" in an "Egg Quality" namespace.

  3. Most SOAP envelopes refer to XML schema defined by the W3C. It is very common to see http://schemas.xmlsoap.org/soap/envelope/ as the namespace reference in a message envelope.

    XML Schema are the successor to DTDs for XML. XML schema describe method calls, and can recognize and enforce data-types, inheritance, and presentation rules. A schema can be part of an XML document or can be referenced as an external file.

  4. Line 2 refers to encodingStyle schema that describes basic data types (Booleans, Integers, Strings, etc.) that can be passed to a remote procedure call. SOAP messages typically define encoding rules using the W3C schema at http://schemas.xmlsoap.org/soap/encoding/.

  5. Line 3 closes the envelope.