Wednesday, March 23, 2011

WSDL (Web Services Description Language)


WSDL (Web Services Description Language) is an XML-based language for describing Web services and how to access them.

What is WSDL?
•WSDL stands for Web Services Description Language
•WSDL is written in XML
•WSDL is an XML document
•WSDL is used to describe Web services
•WSDL is also used to locate Web services
•WSDL is a W3C recommendation

WSDL Describes Web Services
WSDL stands for Web Services Description Language.

WSDL is a document written in XML. The document describes a Web service. It specifies the location of the service and the operations (or methods) the service exposes.


WSDL is a W3C Recommendation
WSDL became a W3C Recommendation 26. June 2007.


A WSDL document is just a simple XML document.

It contains set of definitions to describe a web service.


--------------------------------------------------------------------------------

The WSDL Document Structure
A WSDL document describes a web service using these major elements:

Element Defines
The data types used by the web service
The messages used by the web service
The operations performed by the web service
The communication protocols used by the web service

The main structure of a WSDL document looks like this:




definition of types........The data types used by the web service




definition of a message....The messages used by the web service




definition of a port.......The operations performed by the web service




definition of a binding....The communication protocols used by the web service






A WSDL document can also contain other elements, like extension elements, and a service element that makes it possible to group together the definitions of several web services in one single WSDL document.


--------------------------------------------------------------------------------
WSDL Ports
The element is the most important WSDL element.

It describes a web service, the operations that can be performed, and the messages that are involved.

The element can be compared to a function library (or a module, or a class) in a traditional programming language.


--------------------------------------------------------------------------------

WSDL Messages
The element defines the data elements of an operation.

Each message can consist of one or more parts. The parts can be compared to the parameters of a function call in a traditional programming language.


--------------------------------------------------------------------------------

WSDL Types
The element defines the data types that are used by the web service.

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


--------------------------------------------------------------------------------

WSDL Bindings
The element defines the message format and protocol details for each port.


--------------------------------------------------------------------------------

WSDL Example
This is a simplified fraction of a WSDL document:
















In this example the element defines "glossaryTerms" as the name of a port, and "getTerm" as the name of an operation.

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

The elements define the parts of each message and the associated data types.

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


A WSDL port describes the interfaces (legal operations) exposed by a web service.


--------------------------------------------------------------------------------

WSDL Ports
The element is the most important WSDL element.

It defines a web service, the operations that can be performed, and the messages that are involved.

The port defines the connection point to a web service. It can be compared to a function library (or a module, or a class) in a traditional programming language. Each operation can be compared to a function in a traditional programming language.


--------------------------------------------------------------------------------

Operation Types
The request-response type is the most common operation type, but WSDL defines four types:

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 message but will not wait for a response


--------------------------------------------------------------------------------

One-Way Operation
A one-way operation example:












In the example above, the port "glossaryTerms" defines a one-way operation called "setTerm".

The "setTerm" operation allows input of new glossary terms messages using a "newTermValues" message with the input parameters "term" and "value". However, no output is defined for the operation.


--------------------------------------------------------------------------------

Request-Response Operation
A request-response operation example:
















In the example above, the port "glossaryTerms" defines a request-response operation called "getTerm".

The "getTerm" operation requires an input message called "getTermRequest" with a parameter called "term", and will return an output message called "getTermResponse" with a parameter called "value".




No comments:

Post a Comment