WSDL tutoriallogin
WSDL tutorial
author:php.cn  update time:2022-04-11 14:49:08

WSDL document



A WSDL document is just a simple XML document.

It contains a series of definitions describing a web service.


WSDL document structure

The WSDL document uses these main elements to describe a web service:

##<types>Data types used by web service<binding>Communication protocol used by web service

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

<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 elements, and A service element that combines the definitions of several web services into a single WSDL document. The


WSDL port

<portType> element is the most important WSDL element.


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


The <portType> element can be 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 components. These components can be compared to the parameters of a function call in a traditional programming language.



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>

elements define the message format and protocol details for each port.


WSDL Example

This is a simplified fragment of a WSDL document:


<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, the <portType> element defines "glossaryTerms" as the name of a port and "getTerm" as a operationThe name.

The operation "getTerm" has an input message named "getTermRequest", and an output message named "getTermResponse". The

<message> element defines the parts of each message, as well as the associated data type.

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

Elements Definition
<portType>Operations performed by web service
<message> Messages used by web service