SOAP Encoding

The SOAP encoding style provides a means to define data types similar to what is found in most programming languages, including types and arrays. The specification for encoding can be found at http://schemas.xmlsoap.org/soap/encoding/. SOAP defines simple and complex data types just as the schema standard does. The simple type elements are the same as those defined in the second schema standard. The complex type elements include those defined in the first SOAP standard and a special way of defining arrays. Structures follow the definitions of the complex type. For example, we could have the following structure:

     <CName>John Jones</CName>
     <Address>100 Main Street</Address>

This structure would be defined as follows:

  <element name=Customer>
     <element name="CName" type="xsd:string"/>
     <element name="Address" type="xsd:string"/>
     <element name="ID" type="xsd:string"/>

Arrays will have an additional attribute, type="SOAP-ENC:Array", to define an element as an array. The SOAP-ENC namespace is defined as http://schemas.xmlsoap.org/soap/encoding. An array could look as follows:

  <CustomerIDs SOAP-ENC:arrayType="xsd:int[3]">

The schema would look as follows:

  <element name="CustomerIDs" type="SOAP-ENC:Array"/>

In this example, the array CustomerIDs contains three members; each member has a value of type xsd:int.


This chapter has introduced the basic principles of SOAP. Using these basic principles, you can pass the values for parameters of methods to and from a server using XML and HTTP. As the SOAP specification evolves, it's likely that SOAP will allow tightly bound messages to be sent to and from components on virtually any operating system.

In Chapter 9, we will discuss the BizTalk framework. The BizTalk framework builds on the concepts in SOAP, and allows companies to exchange business documents using XML schemas and industry standards for sharing information.