Web Services Description Language

From Wikipedia, the free encyclopedia

Jump to: navigation, search
Web Services Description Language
File extension:.wsdl
MIME type:application/wsdl+xml
Developed by:World Wide Web Consortium
Contained by:XML
Standard(s):2.0 Recommendation


The Web Services Description Language (WSDL, pronounced 'wiz-dəl' or spelled out, 'W-S-D-L') is an XML-based language that provides a model for describing Web services.

The current version of the specification is the 2.0: version 1.1 has not been endorsed by the W3C while the last, for which several drafts have been released, is a W3C recommendation. [1] WSDL 1.2 was renamed WSDL 2.0 because of its substantial differences from WSDL 1.1. By accepting binding to all the HTTP request methods (not only GET and POST as in version 1.1) WSDL 2.0 specification offers a better support for RESTful web services, much simpler to implement [2][3]. However support for this specification is still poor in software development kits for Web Services which often offer tools only for WSDL 1.1.

The WSDL defines services as collections of network endpoints, or ports. WSDL specification provides an XML format for documents for this purpose. The abstract definition of ports and messages is separated from their concrete use or instance, allowing the reuse of these definitions. A port is defined by associating a network address with a reusable binding, and a collection of ports define a service. Messages are abstract descriptions of the data being exchanged, and port types are abstract collections of supported operations. The concrete protocol and data format specifications for a particular port type constitutes a reusable binding, where the messages and operations are then bound to a concrete network protocol and message format. In this way, WSDL describes the public interface to the web service.

WSDL is often used in combination with SOAP and XML Schema to provide web services over the Internet. A client program connecting to a web service can read the WSDL to determine what functions are available on the server. Any special datatypes used are embedded in the WSDL file in the form of XML Schema. The client can then use SOAP to actually call one of the functions listed in the WSDL.

XLang is an extension of the WSDL such that "an XLANG service description is a WSDL service description with an extension element that describes the behavior of the service as a part of a business process" [1].

Resources or services are exposed using WSDL by both Web Services Interoperability (WS-I Basic Profile) and WSRF framework.

Contents

[edit] Example WSDL file

Here is an example of a structured WSDL 2.0 document: <source lang="xml"> <?xml version="1.0" encoding="UTF-8"?> <description xmlns="http://www.w3.org/ns/wsdl"

            xmlns:tns="http://www.example.com/wsdl20sample" 
            xmlns:whttp="http://www.w3.org/ns/wsdl/http"
            xmlns:wsoap="http://www.w3.org/ns/wsdl/soap"
            targetNamespace="http://www.example.com/wsdl20sample">


  <types>
     <xs:schema xmlns="http://www.example.com/wsdl20sample"
                xmlns:xs="http://www.w3.org/2001/XMLSchema" 
                targetNamespace="http://www.example.com/wsdl20sample">
                
        <xs:element name="request">
           <xs:complexType>
              <xs:sequence>
                 <xs:element name="header" maxOccurs="unbounded">
                    <xs:complexType>
                       <xs:simpleContent>
                          <xs:extension base="xs:string">
                             <xs:attribute name="name" type="xs:string" use="required"/>
                          </xs:extension>
                       </xs:simpleContent>
                    </xs:complexType>
                 </xs:element>
                 <xs:element name="body" type="xs:anyType" minOccurs="0"/>
              </xs:sequence>
              <xs:attribute name="method" type="xs:string" use="required"/>
              <xs:attribute name="uri" type="xs:anyURI" use="required"/>
           </xs:complexType>
        </xs:element>
        
        <xs:element name="response">
           <xs:complexType>
              <xs:sequence>
                 <xs:element name="header" maxOccurs="unbounded">
                    <xs:complexType>
                       <xs:simpleContent>
                          <xs:extension base="xs:string">
                             <xs:attribute name="name" type="xs:string" use="required"/>
                          </xs:extension>
                       </xs:simpleContent>
                    </xs:complexType>
                 </xs:element>
                 <xs:element name="body" type="xs:anyType" minOccurs="0"/>
              </xs:sequence>
              <xs:attribute name="status-code" type="xs:anySimpleType" use="required"/>
              <xs:attribute name="response-phrase" use="required"/>
           </xs:complexType>
        </xs:element>
     </xs:schema>
  </types>


  <interface name="RESTfulInterface">
     <fault name="ClientError" element="tns:response"/>
     <fault name="ServerError" element="tns:response"/>
     <fault name="Redirection" element="tns:response"/>
     <operation name="Get" pattern="http://www.w3.org/ns/wsdl/in-out">
        <input messageLabel="GetMsg" element="tns:request"/>
        <output messageLabel="SuccessfulMsg" element="tns:response"/>
     </operation>
     <operation name="Post" pattern="http://www.w3.org/ns/wsdl/in-out">
        <input messageLabel="PostMsg" element="tns:request"/>
        <output messageLabel="SuccessfulMsg" element="tns:response"/>
     </operation>
     <operation name="Put" pattern="http://www.w3.org/ns/wsdl/in-out">
        <input messageLabel="PutMsg" element="tns:request"/>
        <output messageLabel="SuccessfulMsg" element="tns:response"/>
     </operation>
     <operation name="Delete" pattern="http://www.w3.org/ns/wsdl/in-out">
        <input messageLabel="DeleteMsg" element="tns:request"/>
        <output messageLabel="SuccessfulMsg" element="tns:response"/>
     </operation>
  </interface>


  <binding name="RESTfulInterfaceHttpBinding" interface="tns:RESTfulInterface" 
           type="http://www.w3.org/ns/wsdl/http">
     <operation ref="tns:Get" whttp:method="GET"/>
     <operation ref="tns:Post" whttp:method="POST" 
                whttp:inputSerialization="application/x-www-form-urlencoded"/>
     <operation ref="tns:Put" whttp:method="PUT" 
                whttp:inputSerialization="application/x-www-form-urlencoded"/>
     <operation ref="tns:Delete" whttp:method="DELETE"/>
  </binding>
  
  <binding name="RESTfulInterfaceSoapBinding" interface="tns:RESTfulInterface" 
           type="http://www.w3.org/ns/wsdl/soap" 
           wsoap:protocol="http://www.w3.org/2003/05/soap/bindings/HTTP/"
           wsoap:mepDefault="http://www.w3.org/2003/05/soap/mep/request-response">
     <operation ref="tns:Get" />
     <operation ref="tns:Post" />
     <operation ref="tns:Put" />
     <operation ref="tns:Delete" />
  </binding>
  
  <service name="RESTfulService" interface="tns:RESTfulInterface">
     <endpoint name="RESTfulServiceRestEndpoint" 
               binding="tns:RESTfulInterfaceHttpBinding" 
               address="http://www.example.com/rest/"/>
     <endpoint name="RESTfulServiceSoapEndpoint" 
               binding="tns:RESTfulInterfaceSoapBinding" 
               address="http://www.example.com/soap/"/>
  </service>

</description>


</source>

[edit] Example of WSDL Usage in Adobe Flex

The mx:WebService XML element, as shown below in an extract from a Flex application program, references the WSDL by its Internet URL. The WSDL defines all the operations that the web service offers. One of the operations is "Logon". The Logon operation takes three string arguments (userid, password, language code), as stated in the WSDL, which are sourced via the data binding operator (curly brackets) from text boxes elsewhere in the form (not shown). Flex references the web service with the help of the WSDL document. Any reply from the web service is returned to a DataGrid component as {BBAuthenticate.Logon.lastResult}, which references the web service, the operation, and the most recent data received. <source lang="XML">

   <mx:WebService id="BBAuthenticate" 
       wsdl="http://10.1.1.1/auth.wsdl"
       useProxy="false" showBusyCursor="true" makeObjectsBindable="true">
       <mx:operation name="Logon">
           <mx:request>
               <userName>{yourUserName.text}</userName>
               <password>{yourPassword.text}</password>
               <language>{yourLanguage.text}</language>
           </mx:request>
       </mx:operation>

</mx:WebService>

       <mx:DataGrid rowCount="2" 
                     allowMultipleSelection="true" 
                     x="10" 
                     y="380" 
                     id="authResponse" 
                     width="560" 
                     dataProvider="{BBAuthenticate.Logon.lastResult}" 
                     height="45">

</source>

[edit] References

[edit] External links

ca:WSDL

cs:Web Services Description Language de:Web Services Description Language es:WSDL fr:Web Services Description Language id:WSDL it:Web Services Description Language he:Web Services Description Language hu:Webszolgáltatás leíró nyelv nl:Web Services Description Language ja:Web Services Description Language no:WSDL pl:Web Services Description Language pt:Web Services Description Language ru:WSDL sv:WSDL zh:WSDL

Views
Personal tools

Toolbox