WSDL Document


A WSDL document is just a simple XML document.

It contains a series of definitions that describe a web service.


WSDL Document Structure

WSDL documents use these main elements to describe a web service:

Element Definition
<portType> Operations performed by the web service
<message> Messages used by the web service
<types> Data types used by the web service
<binding> Communication protocols used by the web service

The main structure of a WSDL document is similar to this:

WSDL Document Example

<definitions> <types> data type definitions........ </types> <message> definition of the data being communicated.... </message> <portType> set of operations...... </portType> <binding> protocol and data format specification.... </binding> </definitions>

A WSDL document can contain other elements, such as extension elements, and a service element. This element can combine definitions of several web services into a single WSDL document.


WSDL Port

<portType>The element is the most important WSDL element.

It can describe a web service, the operations that can be performed, and the related messages.

You can compare the <portType> element to a function library (or a module, or a class) in traditional programming languages.


WSDL Message

<message>The element defines the data elements of an operation.

Each message consists of one or more parts. These parts can be compared to the parameters of a function call in traditional programming languages.


WSDL types

<types>The element defines the data types used by the web service.

For maximum platform neutrality, WSDL uses XML Schema syntax to define data types.


WSDL Bindings

<binding>The element defines message format and protocol details for each port.


WSDL Example

This is a simplified fragment of a WSDL document:

Example

<message name="getTermRequest"> <part name="term" type="xs:string"/> </message> <message name="getTermResponse"> <part name="value" type="xs:string"/> </message> <portType name="glossaryTerms"> <operation name="getTerm"> <input message="getTermRequest"/> <output message="getTermResponse"/> </operation> </portType>

In this example,<portType>The element defines "glossaryTerms" as a certainport's name, and defines "getTerm" as a certainoperation's name.

The operation "getTerm" has aninput message named "getTermRequest", and anoutput message named "getTermResponse".。

<message>The element can define each message'sparts, and the associated data types.

Compared with traditional programming, glossaryTerms is a function library, and "getTerm" is a function with input parameter "getTermRequest" and return parameter getTermResponse.

Other Extensions