Developing XML Solutions (DV-MPS General)

[Previous] [Next]

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:

<e:Customer> <CName>John Jones</CName> <Address>100 Main Street</Address> <ID>4</ID> </e:Customer>

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"/> </element>

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]"> <number>345</number> <number>354</number> <number>399</number> </CustomerIDs>

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.

Категории