Web Services Description Language

From Wikipedia, the free encyclopedia

Jump to: navigation, search
Web Services Description Language
Image:WSDL.svg
Filename extension .wsdl
Internet media 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.

Contents

[edit] Description

The current version of the specification is 2.0; version 1.1 has not been endorsed by the W3C but version 2.0 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 better support for RESTful web services, and is 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.

A representation of concepts defined by a WSDL 1.1 document.

The WSDL defines services as collections of network endpoints, or ports. The WSDL specification provides an XML format for documents for this purpose. The abstract definition of ports and messages are 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 operations and messages 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.

[edit] Objects in a 1.1 WSDL

The hierarchy of objects in a WSDL 1.1 document.

Service: The service can be thought of as a container for a set of system functions that have been exposed to the web based protocols.

Port: The port does nothing more than define the address or connection point to a web service. This typically is a represented by a simple http url string.

Binding: Specifies the port type, defines the soap binding style (RPC/Document) and transport (SOAP Protocol). The binding section also defines the operations.

Port Type: The <portType> element defines a web service, the operations that can be performed, and the messages that are used to perform the operation.

Operation: Each operation can be compared to a method or function call in a traditional programming language. Here the soap actions are defined and the way the message is encoded for example, "literal."

Message: Typically, a message corresponds to an operation. The message contains the information needed to perform the operation. Each message consist of one or more logical parts. Each part is associated with a message-typing attribute. The message name attribute provides a unique name among all messages. The part name attribute provides a unique name among all the parts of the enclosing message. Parts are a description of the logical content of a message. In RPC binding, a binding may reference the name of a part in order to specify binding-specific information about the part. A part may represent a parameter in the message, the bindings define the actual meaning of the part.

Element: Elements are defined with in the <types> tag. An element consists of a unique name, and data type. The purpose of a an element WSDL is to describe the data and define the tag which delimits the data sent in the message parameters. Elements can be simple types such as strings or integers. Simple Types can have enumerations (lists of acceptable values) or restrictions defined (length not to exceed 10 characters). In addition, elements can have complex types. Complex types can nest other elements with in them.

XSD Files: Elements are often defined in an XML Schema Definition (XSD) file. The XSD can be in the same WSDL file or in a separate file. The XSD is imported to the WSDL through the use of the wsdl import tag with a reference to the namespace of the XSD document. When an XSD refers to elements defined in another XSD file, the external XSD namespace must be imported into the XSD referencing the element. If the XSD is not defined directly in the WSDL, the namespace specifies the location of the XSD file in URL syntax.

[edit] Example WSDL file

Here is an example of a structured WSDL 2.0 document:

<?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">
 
 
<!-- Abstract types -->
   <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>
 
 
<!-- Abstract interfaces -->
   <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>
 
 
 
<!-- Concrete Binding Over HTTP -->
   <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>
 
<!-- Concrete Binding with SOAP-->
   <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>
 
 
<!-- Web Service offering endpoints for both the bindings-->
   <service name="RESTfulService" interface="tns:RESTfulInterface">
      <endpoint name="RESTfulServiceHttpEndpoint" 
                binding="tns:RESTfulInterfaceHttpBinding" 
                address="http://www.example.com/rest/"/>
      <endpoint name="RESTfulServiceSoapEndpoint" 
                binding="tns:RESTfulInterfaceSoapBinding" 
                address="http://www.example.com/soap/"/>
   </service>
</description>

[edit] History

WSDL 1.0 (Sept. 2000) has been developed by IBM, Microsoft and Ariba to describe Web Services for their SOAP toolkit.

WSDL 1.1, published on March 2001, is the formalization of WSDL 1.0. No major changes were introduced between 1.0 and 1.1.

WSDL 1.2 (June 2003) is still a working draft at W3C. According to W3C: WSDL 1.2 is easier and more flexible for developers than the previous version. WSDL 1.2 attempts to remove non-interoperable features and also defined the better HTTP 1.1 binding. WSDL 1.2 was not supported by most of the SOAP servers/vendors.

WSDL 2.0 became a W3C recommendation on June 2007. WSDL 1.2 was renamed to WSDL 2.0 because it has substantial differences from WSDL 1.1. The changes are:

  • Adding further semantics to the description language
  • Removal of message constructs
  • No support for operator overloading
  • PortTypes renamed to interfaces
  • Ports renamed to endpoints.

[edit] References

[edit] External links


Personal tools