WSDL document
An 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 |
Define |
---|---|
<portType> |
Actions performed by web service |
< message > |
Messages used by web service |
< types > |
Data types used by web service |
< binding > |
Communication protocols used by web service |
The main structure of an WSDL document is something like this:
WSDL document instance
<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>
WSDL documents can contain other elements, such as extension
element, and a service
element, which combines several web services definitions into a single WSDL document.
WSDL port
<portType>
Element is the most important WSDL element.
It describes a web service, actions that can be performed, and related messages.
You can put <portType>
Element is compared to a function library (or a module, or a class) in a traditional programming language.
WSDL message
<message>
Element defines the data element of an operation.
Each message consists of one or more parts. These parts can be compared to the parameters of a function call in a traditional programming language.
WSDL types
<types>
Element defines the data type used by web service.
For maximum platform neutrality, WSDL uses XML Schema syntax to define data types.
WSDL Bindings
<binding>
Element defines the message format and protocol details for each port.
WSDL instance
This is a simplified fragment of an WSDL document:
Example
<messagename="getTermRequest"><partname="term"type="xs:string"/></message><messagename="getTermResponse"><partname="value"type="xs:string"/></message><portTypename="glossaryTerms"><operationname="getTerm"><inputmessage="getTermRequest"/><outputmessage="getTermResponse"/></operation></portType>
In this case, the <portType>
element defines “glossaryTerms” as the name of a port and “getTerm” as the name of an operation.
The operation “getTerm” has an input message named “getTermRequest” and an output message named “getTermResponse”.
<message>
Element defines the part of each message and the associated data type.
Compared to traditional programming, glossaryTerms is a function library, while “getTerm” takes input parameters “getTermRequest” and return parameters. A function of getTermResponse
.