Complex Types
Our final topic is the use of complex data types. For example, consider a home monitoring service that provides a concise update on your home. The data returned could include multiple data elements, such as the current temperature, security status, and whether the garage door is open or closed. Encoding this data into WSDL requires additional knowledge of XML Schemas, which reinforces the main precept that the more you know about XML Schemas, the better you will understand complex WSDL files.
To explore complex types, consider the WSDL file in Example 6-10. This WSDL file describes our Product Service from Chapter 5. The complex types are indicated in bold.
<?xml version="1.0" encoding="UTF-8"?> <definitions name="ProductService" targetNamespace="http://www.ecerami.com/wsdl/ProductService.wsdl" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.ecerami.com/wsdl/ProductService.wsdl" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsd1="http://www.ecerami.com/schema"> <types> <xsd:schema targetNamespace="http://www.ecerami.com/schema" xmlns="http://www.w3.org/2001/XMLSchema"> <xsd:complexType name="product"> <xsd:sequence> <xsd:element name="name" type="xsd:string"/> <xsd:element name="description" type="xsd:string"/> <xsd:element name="price" type="xsd:double"/> <xsd:element name="SKU" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:schema> </types> <message ...
Get Web Services Essentials now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.