WSDL - Web Services Description Language.• As the name suggest it is language which describes the web services.• WSDL (Web Services Description Language) is an XML-based language for describing Web services and how to access them.• It is a document that is written in XML. This document describes a Web service. It specifies the location of the service and the operations or methods the service exposes.• It is a W3C recommendation.• It is an XML grammar that defines the functionality offered by a Web service and the format of messages sent and received by the Web service. It defines what services are available in the Web service. It also defines the methods, parameter names, parameter data types, and return data types for the Web service. An application that uses a Web service relies on the Web service's WSDL document to access the Web.• It is an XML message format for describing the network services offered by the server. You use WSDL to create a file that identifies the services provided by the server and the set of operations within each service that the server supports. For operation, the WSDL file also describes the format that the client must follow in requesting an operation. Because the WSDL file sets up requirements for both server and client, this file is like a contract: The server agrees to provide certain services if the client sends a properly formatted SOAP request. A client who wants to send a SOAP request to the server first obtains a copy of this WSDL file from the server. The client then uses the information in this file to format a SOAP request. The client sends this request to the server. The server executes the requested operation and sends the result back to the client as a SOAP response. • The WSDL document can be divided into two groups: o The Abstract Definitions Group o The Concrete Descriptions Group. The abstract sections define SOAP messages in a platform- and language-independent manner; they don't contain any machine- or language-specific elements. The concrete sections are site-specific, machine-specific, or language-specific. The abstract elements are types, message, and portType. The concrete elements are binding and service.Here is the the position where WSDL stands
WSDL Usage:
WSDL is used in combination with SOAP and XML Schema to provide web services over the Internet. A Web service requester or client program connecting to a web service can read the WSDL to determine what functions are available on the server. Any special data types that are used are embedded in the WSDL file in the form of XML Schema. The Web service requester or client program can then use SOAP to actually call one of the functions listed in the WSDL.
WSDL Elements
● Types
● Message
● Operation
● Port Type
● Binding
● Port
● Service
To Explain that I have used the following webservice.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
/// <summary>
/// Summary description for TestWebService
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class TestWebService : System.Web.Services.WebService {
public TestWebService () {
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public string HelloWorld() {
return "Hello World";
public int GetSum(int a,int b)
{
return a+b;
It has two methods
HelloWorld
No Input parameters
Return String
GetSum
Two Input parameters of integer type
Return Integer
Its WSDL Document is
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://tempuri.org/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
<s:element name="HelloWorld">
<s:complexType />
</s:element>
<s:element name="HelloWorldResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="HelloWorldResult" type="s:string" />
</s:sequence>
</s:complexType>
<s:element name="GetSum">
<s:element minOccurs="1" maxOccurs="1" name="a" type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="b" type="s:int" />
<s:element name="GetSumResponse">
<s:element minOccurs="1" maxOccurs="1" name="GetSumResult" type="s:int" />
</s:schema>
</wsdl:types>
<wsdl:message name="HelloWorldSoapIn">
<wsdl:part name="parameters" element="tns:HelloWorld" />
</wsdl:message>
<wsdl:message name="HelloWorldSoapOut">
<wsdl:part name="parameters" element="tns:HelloWorldResponse" />
<wsdl:message name="GetSumSoapIn">
<wsdl:part name="parameters" element="tns:GetSum" />
<wsdl:message name="GetSumSoapOut">
<wsdl:part name="parameters" element="tns:GetSumResponse" />
<wsdl:portType name="TestWebServiceSoap">
<wsdl:operation name="HelloWorld">
<wsdl:input message="tns:HelloWorldSoapIn" />
<wsdl:output message="tns:HelloWorldSoapOut" />
</wsdl:operation>
<wsdl:operation name="GetSum">
<wsdl:input message="tns:GetSumSoapIn" />
<wsdl:output message="tns:GetSumSoapOut" />
</wsdl:portType>
<wsdl:binding name="TestWebServiceSoap" type="tns:TestWebServiceSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<soap:operation soapAction="http://tempuri.org/HelloWorld" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
</wsdl:output>
<soap:operation soapAction="http://tempuri.org/GetSum" style="document" />
</wsdl:binding>
<wsdl:binding name="TestWebServiceSoap12" type="tns:TestWebServiceSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
<soap12:operation soapAction="http://tempuri.org/HelloWorld" style="document" />
<soap12:body use="literal" />
<soap12:operation soapAction="http://tempuri.org/GetSum" style="document" />
<wsdl:service name="TestWebService">
<wsdl:port name="TestWebServiceSoap" binding="tns:TestWebServiceSoap">
<soap:address location="http://localhost:1812/BuildingSimpleWebservice/TestWebService.asmx" />
</wsdl:port>
<wsdl:port name="TestWebServiceSoap12" binding="tns:TestWebServiceSoap12">
<soap12:address location="http://localhost:1812/BuildingSimpleWebservice/TestWebService.asmx" />
</wsdl:service>
</wsdl:definitions>
Element
Defines
<portType>
The operations performed by the web service
<message>
The messages used by the web service
<types>
The data types used by the web service
<binding>
The communication protocols used by the web service
We will discuss each of that elements one by one .
WSDL Types
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.
Here it is telling that for element GetSum the data types that we are passing are int
And in resposnse (GetSumResponse) we will get one integer type parameter as output .
WSDL Ports Type
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. TestWebServiceSoap can be considered as function library .HelloWorld and GetSum can be considered as functions.,and HelloWorldSoapIn, HelloWorldSoapOut,GetSumSoapIn, GetSumSoapOutcan be considered as parameters.
So in above HelloWorld and GetSum are the operations involved.
Operations can be of 4 types
● One-way
The endpoint receives a message
● Request/response
The endpoint receives a message, and sends a correlated message
● Notification
The endpoint sends a message
● Solicit/response
The endpoint sends a message, and receives a correlated message
WSDL Messages
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.
WSDL PORT
· It is a single endpoint defined as a combination of a binding and a network address.
· The port element has two attributes - the name attribute and the binding attribute.
· The name attribute provides a unique name among all ports defined within in the enclosing WSDL document.
· The binding attribute refers to the binding using the linking rules defined by WSDL.
· A port MUST NOT specify more than one address.
WSDL Bindings
Each binding element describes a supported protocol. Similar to the portType element, the binding element includes supported operations, as well as the input and output for each operation. It is concrete protocol and data format specification for a particular port type.
WSDL Service
It is a collection of related endpoints. The service element is a collection of ports. Each port supports a different protocol.
WSDL View of a Web Service
What kind of email newsletter would you prefer to receive from CodeAsp.Net?18