WSDL Enters….
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
Introducing WSDL
- 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
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
Operation 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 type
The operation can receive a message but will not return a response
Subscribe to our youtube channel to get new updates..!
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
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.
I want to pass a complex object to my web service……what do I need to do
WSDL Types
- The 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
WSDL Bindings
The element defines the message format and protocol details for each port.
Binding
- name – can be anything
- Type – points to port
Soap:binding
- Style – rpc or document
- Transport – soap protocol to use
Operation
- Defines each operation the the service exposes
WSDL Bindings
- The 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 , 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:
- soap:binding
- soap:operation
- soap:body
- You can specify multiple bindings for a single portType.
WSDL Services
The 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:
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.
Example