 |
|
|
WSDL and the XML Schema Specification
Even though you can use any encoding format for WSDL type definitions, the WSDL specification suggests using XML Schema Definitions (XSD). XSD or XML Schema is a W3C standard that seeks to supersede the document type definition (DTD) standard for defining structure within an XML document. XML Schema defines a comprehensive set of programming-language independent, primitive/simple data types, such as doubles, strings, and integers, as well as a mechanism for creating complex types using the predefined simple types (see Table 1).
Table 1. XML Schema Simple Types: The table shows a list of the simple types predefined in XSD.
| Simple Type
|
Examples
|
| string |
This is a string |
| normalizedString |
This is a normalized string |
| token |
This is a token |
| base64Binary |
GpM7 |
| hexBinary |
0FB7 |
| integer |
-1, 0, 103 |
| positiveInteger |
1, 2, 215 |
| negativeInteger |
-563, -2, -1 |
| nonNegativeInteger |
0, 1, 2, 672 |
| nonPositiveInteger |
37 -2, -1, 0 |
| long |
-9223372036854775808, ... -1, 0, 1, ... 9223372036854775807 |
| unsignedLong |
0, 1, ... 18446744073709551615 |
| int |
-2147483648, ... -1, 0, 1, ... 2147483647 |
| unsignedInt |
0, 1, ...4294967295 |
| short |
-32768, ... -1, 0, 1, ... 32767 |
| unsignedShort |
0, 1, ... 65535 |
| byte |
-128, ...-1, 0, 1, ... 127 |
| unsignedByte |
0, 1, ... 255 |
| decimal |
-1.23, 0, 123.4, 1000.00 |
| float |
-INF, -1E4, -0, 0, 12.78E-2, 12, INF, NaN |
| double |
-INF, -1E4, -0, 0, 12.78E-2, 12, INF, NaN |
| boolean |
true, false, 1, 0 |
| duration |
P1Y2M3DT10H30M12.3S |
| dateTime |
1999-05-31T13:20:00.000-05:00 |
| date |
1999-05-31 |
| time |
13:20:00.000, 13:20:00.000-05:00 |
| gYear |
1999 |
| gYearMonth |
1999-02 |
| gMonth |
05 |
| gMonthDay |
05-31 |
| gDay |
-31 |
| Name |
shipTo |
| QName |
po:USAddress |
| NCName |
USAddress |
| anyURI |
http://www.example.com/,http://www.example.com/doc.html#ID5 |
| language |
en-GB, en-US, fr |
The WSDL <types> element defines data types that are to be exchanged between service consumers and providers. If the service defined by the WSDL document uses only the built-in XML Schema simple types, you don't have to include a <types> element; instead, you can use the element to define your own types. Listing 1 shows a simple WSDL document that includes a <types> element:
|