Thursday, 17 November 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.
  • WSDL is used to describe Web services

  • WSDL is also used to specifies the location of the service and the operations (or methods) the service exposes.

  • WSDL is written in XML

  • WSDL is an XML document


  • The WSDL Document Structure:-
    It contains set of definitions to describe a web service.A WSDL document describes a web service using these major elements:
    <types>The data types used by the web service
    <message>The messages used by the web service
    <portType>The operations performed by the web service
    <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 <portType> element can be compared to a function library (or a module, or a class) in a traditional programming language.
    ex:-
    <portType name="EmployeeDetail">
      <operation name="getEmployeeDetail">
        <input message="getEmployeeIDRequest"/>
        <output message="getEmployeeDetailResponse"/>
      </operation>
    </portType>

    WSDL Messages:-The <message> element defines the data elements of an operation.
    ex:-
    <message name="getEmployeeIDRequest">
      <part name="ID" type="xs:integer"/>
    </message>

    <message name="getEmployeeDetailResponse">
      <part name="value" type="xs:string"/>
    </message>

    WSDL Types:-The <types> element defines the data types that are used by the web service.

    WSDL Bindings:-The <binding> element defines the message format and protocol details for each port.
    The binding element has two attributes - name and type.The name attribute (you can use any name you want) defines the name of the binding, and the type attribute points to the port for the binding.
    <binding type="glossaryTerms" name="b1">
       <soap:binding style="document"
       transport="http://schemas.xmlsoap.org/soap/http" />
       <operation>
         <soap:operation soapAction="http://example.com/getTerm"/>
         <input><soap:body use="literal"/></input>
         <output><soap:body use="literal"/></output>
      </operation>
    </binding>
    The operation element defines each operation that the port exposes.


     

    2 comments: