What is Web Services Description Language (WSDL)?
Guide With Document Format and Example
WSDL is something that anyone involved in every web service will be familiar with adequately. Used as a means for explaining the web services, WSDL is the best pal for SOAP and REST.
In this post, we are trying to bring everything crucial related to WSDL with some real-time document examples. So, if you have anything to do with web services, pay attention to what we’re going to state next.
What is WSDL?
WSDL is a means for explaining the key functions offered by a said web service. It’s an interface description language that utilizes XML syntax and formatting.
It presents a highly machine-readable explanation of factors like how that particular web service is called for, what parameters are required for that service, and what sort of data structures are returned by it. Both the abstract as well as concrete web service elements are elaborated extensively with WSDL.
Seeing the kind of similarities it shares with the type signature, it’s often considered as its synonym.
Here are some of the key facts about WSDL (Web Services Description Language):
Type- XML-based interface description language
Existing Version- WSDL 2.0.
Developed by- World Wide Web Consortium
Used Technology- Extensible Markup Language (XML)
Used by- UDDI
Looks like your basics about WSDL are clear now. So, let’s dig into the history to know it a little better!
WSDL came into being in 2000 when the three IT giants, Ariba, IBM, and Microsoft, joined hands. The purpose behind its invention was to have an easy way to explain the existing SOAP toolkit. To design WSDL, two key service description languages, SDL and NASSL, were combined.
The first version was named WSDL 1.0. After certain minor changes, the version WSDL 1.1 was accepted as the standard form of WSDL in 2001.
By the time world reached in 2003, another WSDL version, version WSDL 1.2, was present at W3C in. W3C suggested that the latest version, WSDL 1.2, is much easier to work with and grants more freedom to developers as compared to WSDL 1.1.
Much later, in 2007, WSDL 1.2 became the WSDL 2.0 version and secured a place in the W3C recommendation. However, the majority of third-party service providers kept on offering support only for WSDL 1.1 until very recently.
Speaking of changes between the two versions, WSDL 2.0 no longer has message constructs, ports are known as endpoints, PortTypes become interfaces, and there is no overloading support for the operator. Also, a wide range of semantics was in the description language.
Getting Familiar with the Key Part: WSDL Document Structure
A typical WSDL document is what any end-user has to use to define the targeted web service. So, having an in-depth understanding of its elements is crucial for you to gain.
WSDL files contain the location details of the web services alongside the process related to these web services. It comprises information about SOAP messages shared and the acknowledgments exchanged.
On the surface, the WSDL document can look too clumsy and confusing as assorted web service-related data is mentioned in it. But, that data is later used by other client applications too.
To put it precisely, WSDL is very similar to the real-life postcard, containing the address of a web service comprising major functionalities that might need to be delivered on the client’s request.
WSDL Elements with Syntax and Examples
A WSDL document needs different sorts of elements to explain such crucial details about a web service. These are:
Element #1 - Definitions
Holding a web service’s name, you may call it the crucial-most part of WSDL. Initialized at the top of a WSDL document, it states various namespaces with their respective service elements.
Being the root, it is closed when the service description ends.
Some namespaces like schema, soap, and wsdl are recognized by most of the commonly-used parsers by default while others need to be defined.
The syntax is:
Here, the URI for the target namespace must be the same as the one being assigned a prefix to.
The variable 'name' holds the WSDL document's name.
xmlns:wsdl is used to assign a namespace prefix for elements belonging to the core WSDL while xmls:xxxx assigns a namespace prefix for elements that are imported from diverse languages but being used as WSDL extensions.
Element #2 - Data Types
It explains what type of data is exchanged in messages. It is crucial as it allows precise handling of the data types at client’s end. At the same type, it also helps in the correct processing of web service.
Example: Let’s define EntReq and ExitRes data types:
Element #3 - Message
In general, the message is all about performing an information exchange. In the case of WSDL, this client-server communication is regarding the web service in question.
The message element is commonly used to state key details of the outputs and inputs operations. It can be displayed like a mapped argument or a document.
Here, the message token’s name is messageTKN1 while the reference name for it is messageTKN2. The ‘element’ or ‘type’ indicates the message data type for this namespace.
Element #4 - Operation
It carries a series of message operations. For instance: message queue, business process, and name-conventions for message(s), etc.
There are 4 operation types you can use in WSDL documents:
- One-way, where only an input is sent.
- Notification, where only the response is received.
- Solicit-response, where an input is given to revert to a notification/output.
- Request-response, where an output is received for the input message given.
Syntax: A typical request-response operation will have syntax similar to:
Element #5 - Port type
It is used to turn all kinds of inputs and outs into reasonable operations. It includes a crisp operation set used to explain the binding operations. As this element is used in abstract form, mapping it to assorted transports is easy.
Element #6 - Binding
Binding is what WSDL documents used as the basic protocol and data format to define the operations and messages for a specific port type. It is mainly used when the client application needs a relevant port type.
Element #7 - Port
Port refers to the binding combined with the network address. Its purpose is to provide the service communication address.
Element #8 - Service
Service refers to web service and the collection of all the end-points used for defining the service definition. It may comprise a documentation element and multiple port elements.
In addition to the above-mentioned key WSDL elements, there are two more utilities you might want to hear about:
- The first one is the document commonly used to hand over easy-to-read documents. These documents are human-readable and can be a part of any other WSDL element.
- The second utility WSDL element is imported and is used to bring any kind of other WSDL document or XML Schemas as per the need of the part.
An Example of WSDL
We have already got familiar with WSDL binding and know that it is used to explain the process using which a web service is linked with a message protocol. Most commonly, the at-work messaging protocol is SOAP messaging protocol
So, SOAP binding is another term that one used to get familiar with. In general, a WSDL SOAP binding is a Remote Procedure Call (RPC) style based binding. In certain cases, it is also the document style binding. It can have an encoded use or a literal use.
Those who are using WSDL 1.1 will be able to enjoy an in-built extension to process SOAP 1.1 and makes explaining the SOAP specifics easier than ever. The key SOAP specifics that can be explained easily with that in-build extension are SOAP encoding styles, SOAP headers, and SOAPAction HTTP header.
The key SOAP binding extension elements are explained below:
With the help of this element, one will be able to understand that binding is possible via SOAP. There are certain key attributes of this element with distinct meanings. For instance, the style attribute of this element refers to the SOAP message format while the rpc style value denotes the RPC format. With the transport attribute, one can find out about the transit of the SOAP messages.
This element is here to explain the specific operation binding required for SOAP implementation. It includes the soapAction attribute to explain the SOAPAction HTTP header service identification.
Using this SOAP binding element, one is capable of explaining the input and output message details.
WSDL is a key description language making the process of web service implementation in one particular language from another programming language easier than ever. A WSDL document defines what a service does and how it needs to be executed. Its various elements work together to better explain the web service.