SCDJWS Study Guide: WSDL


Printer-friendly version Printer-friendly version | Send this 
article to a friend Mail this to a friend


Previous Next vertical dots separating previous/next from contents/index/pdf Contents

WSDL Document Structure

A WSDL document is an XML document that adheres to the WSDL XML schema.  The WSDL schema is available at http://schemas.xmlsoap.org/wsdl/. Theoretically, WSDL can be used to describe any kind of Web service. In this document, only Web services that are SOAP based and compliant with the WS-I Basic Profile 1.0. are described.

The WSDL document is divided into six major elements which come from the “http://schemas.xmlsoap.org/wsdl/” namespace.

  1. The <definitions> element MUST be the root element of all WSDL documents. It defines the name of the web service, declares multiple namespaces used throughout the remainder of the document, and contains all the service elements described here.

  2. The <types> element describes all the data types used between the client and server. WSDL is not tied exclusively to a specific typing system, but it uses the W3C XML Schema specification as its default choice. If the service uses only XML Schema built-in simple types, such as strings and integers, the types element is not required.

  3. The <message> element describes a one-way message, whether it is a single message request or a single message response. It defines the name of the message and contains zero or more message <part> elements, which can refer to message parameters or message return values.

  4. The <portType> element combines multiple message elements to form a complete one-way or round-trip operation. For example, a portType can combine one request and one response message into a single request/response operation, most commonly used in SOAP services. Note that a portType can (and frequently does) define multiple operations.

  5. The <binding> element describes the concrete specifics of how the service will be implemented on the wire. WSDL includes built-in extensions for defining SOAP services, and SOAP-specific information therefore goes here.

  6. The <service> element defines the address for invoking the specified service. Most commonly, this includes a URL for invoking the SOAP service.

In addition to the six major elements, the WSDL specification also defines the following utility elements:

The <documentation> element is used to provide human-readable documentation and can be included inside any other WSDL element.

The <import> element is used to import other WSDL documents or XML Schemas. This enables more modular WSDL documents. For example, two WSDL documents can import the same basic elements and yet include their own service elements to make the same service available at two physical addresses. Note, however, that not all WSDL tools support the import functionality as of yet.

NOTE: The WSDL schema requires that all sections appear in a specific order: import, types, message, portType, binding, and service. Each abstract section may be in a separate file by itself and imported into the main document.



Previous Next vertical dots separating previous/next from contents/index/pdf Contents

  |   |