What is WSDL in Web Services
A WSDL document is just a simple XML document.
It contains set of definitions to describe a web service.
WSDL document fulfills all the above requirements
- Requirement 1 – Where is the service hosted
- Requirement 2 – What protocol to use to talk to the service
- Requirement 3 – What are the operations
- Requirement 4 – What are the parameters
- Requirement 5 – What is the datatype of the messages
- WSDL stands for Web Services Description Language
- WSDL is written in XML
- WSDL is used to describe Web services
- WSDL is also used to locate Web services
- WSDL is a W3C recommendation
WSDL Document Structure
- The <portType> 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 <portType> element can be compared to a function library (or a module, or a class) in a traditional programming language
|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 type
The operation can receive a message but will not return a response
Request-response operation type
The operation can receive a request and will return a response
Now, a web service operation can take only one parameter. But I want to pass multiple parameters……what do I need to do
- The <message> 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.
I want to pass a complex object to my web service……what do I need to do
- The <types> element defines the data type that are used by the web service.
- For maximum platform neutrality, WSDL uses XML Schema syntax to define data types.
I want my web service to be accessible to a HTTP client, as well as to a RMI client and a SOAP client……what do I need to do
The <binding> element defines the message format and protocol details for each port.
- name – can be anything
- Type – points to port
- Style – rpc or document
- Transport – soap protocol to use
- Defines each operation the the service exposes
- The <binding> element provides specific details on how a portType operation will actually be transmitted over the wire.
- The bindings can be made available via multiple transports, including HTTP GET, HTTP POST, or SOAP.
- The bindings provide concrete information on what protocol is being used to transfer portType operations.
- For SOAP protocol, the binding is <soap:binding>, and the transport is SOAP messages on top of HTTP protocol.
- WSDL 1.1 includes built-in extensions for SOAP 1.1. This enables you to specify SOAPspecific details, including SOAP headers, SOAP encoding styles, and the SOAPAction HTTP header. The SOAP extension elements include:
- You can specify multiple bindings for a single portType.
The <services> element connects the binding to an actual URL where the service is available.
A service element describes a Web service as a collection of port elements. A port element defines a specific network address for a binding. The sample below shows the basic outline of a service that supplies an address for a SOAP binding:
<port name=”PortName” binding=”BindingRef“>
The ServiceName sets the name of the service. The PortName sets the name of the specific address. The BindingRef refers to the name of a binding element. The BindingRef must be namespace qualified if the targetNamespace for the WSDL definitions element is not the same as the default namespace.
Enroll for Instructor Led Live Tibco BW Training