Example 6-6, shown later in this section, is a sample WSDL
file that illustrates the use of arrays. This is the Price List
Service we created in Chapter 5. The service has
one public method, called
expects an array of string SKU values and returns an array of double
The WSDL file now includes a
types element. Inside
this element, we have defined two new complex types. Very broadly,
the XML Schema defines simple types and complex types. Simple types
cannot have element children or attributes, whereas complex types can
have element children and attributes. We have declared complex types
in our WSDL file, because an array may have multiple elements, one
for each value in the array.
The XML Schema requires that any new type
you create be based on some existing data type. This existing base
type is specified via the
base attribute. You can
then choose to modify this base type using one of two main methods:
Extension simply means that your new data type will have all the
properties of the base type plus some extra functionality.
Restriction means that your new data type will have all the
properties of the base data type, but may have additional
restrictions placed on the data.
In Example 6-6, we’ll create two new complex types via restriction. For example:
<complexType name="ArrayOfString"> <complexContent> <restriction base="soapenc:Array"> <attribute ref="soapenc:arrayType" wsdl:arrayType="string"/> </restriction> ...