Introduction to WSDL

Introduction to WSDL

It stands for Web Services Description Language. A WSDL is basically an XML document. It contains set of definitions to describe a web service. Whenever one needs to you use a web service one needs to the get hold of its WSDL. It gives you the information regarding how to invoke the particular web service.
A WSDL Structure looks like as shown below:


<types> Definition of types </types>

<messages> Definition of messages </messages>

<portType> Definition of a port </portType>

<binding> Definition of a binding </binding>



WSDL Ports

The <PortType> represent the operation and the messages involved in the WSDL. In the example given below portType name is “Hellotest” and the operation name is “process” which contains input and output. PortType name is the reference which will be used in other parts of the WSDL file.

There are different types of operations involved in WSDL.

Type Definition
One-Way:The operation can receive a message but will not return a response.
Request-Response:The operation can receive a request and will return a response.
Solicit-response:The operation can send a request and will wait for a response.
Notification:The operation can send a request but will not wait for a response

The above example given is Request-Response type operation as it has an input
and an output message both.

WSDL Messages:

The <message > element defines the data elements of an operation.
The message can have multiple parts in it. All the operations have message
element and we need to define these messages.

WSDL Types

The <type> element defines the data type that is used by the web
services. For maximum platform neutrality, WSDL uses XML Schema syntax to
define data types. It is possible to import schema files from outside. One
can import the xsd file like shown in the example above.

WSDL Binding

If we need to create the web service which is accessible from HTTP client and also from other clients like RMI client, we need to define the protocols which will be required to communicate with the web service. This information is present in the Binding element of WSDL. The <binding> element defines the message format and protocol for each port. We can see binding is being tied to a operation type “hellotest” which is the same as the portType name shown in the example in WSDL Ports section. So the
<binding > element provides specific details on how a portType operation will actually be transmitted over the wire. One can specify multiple binding for a single portType.

WSDL Services

The <services> element connects the binding to an actual URL where
the service is available. This service is bound to a binding. So if we
have two bindings then we need to have to two URLs.


Below is the example of how the complete WSDL file looks like.

Copyright © 2021 BTSS Corp.