2.8 WSDL in a nutshell

2.8 WSDL in a nutshell

Web Services Description Language (WSDL), one of the three seminal standards behind Web services, is an XML dialect that relies heavily on XML namespaces and XML schema. It is used to define the high-level functionality of a Web service in terms of its external interface and to describe how that Web service can be accessed over the Web. It is, in effect, an abstract model per an XML-based format for describing Web services.

Potential users of a Web service would typically locate the Web service using its textual description as published in a UDDI repository. Initially this Web service description per se will usually not be in WSDL form. However, when a potential user wants more details as to how a Web service actually functions, particularly in terms of what it accepts as input and what it will return as its output, the user will request it in WSDL form. The link to the WSDL definition of a Web service will be maintained in the UDDI Registry as a part of the overall description of the Web service. The WSDL description will also specify where the service can be found (i.e., its location within the Web) and how it should be invoked. WSDL enables one to separate the description of the abstract functionality offered by a service (i.e., its interface) from specific details of a service description, such as how and where that functionality is offered .

The mechanics of WSDL are such that in reality WSDL is a scheme for generically describing network services as a set of endpoints that function via exchanging messages containing either document-oriented or procedure-oriented information. These message exchange operations and messages are described abstractly in an implementation-neutral manner.

A WSDL-based description of a Web service starts with the messages (i.e., the inputs and outputs) that will be exchanged between the service provider and service requester. These messages are described abstractly in terms of their name and type (e.g., character string, date/time, and so forth). Each message is then bound to a concrete network protocol (e.g., SOAP, HTTP, and so forth) and message format. Thus, a message consists of a collection of typed data items. An exchange of messages between the service provider and requester, as in a transaction, is then described as an operation. A WSDL operation thus consists of a set of previously defined messages. A set of operations is, in turn , called a port type.

Within this context, a (Web) service per se is thought of as being made up of a set of ports , where each port is an implementation of a port type. With WSDL, operations and messages are described abstractly and then bound to a concrete network protocol (e.g., SOAP) and message format to define an endpoint. WSDL can be used with SOAP, HTTP, and MIME (i.e., Multipurpose Internet Mail Extensions, the popular and official Internet standard that specifies how messages must be formatted so that they can be exchanged between different e-mail systems). If we take SOAP as an example, then a WSDL definition describes a set of SOAP messages and how those messages are to be exchanged.

Figure 2.9 illustrates an example of a WSDL definition, as found in the W3C specification for WSDL Version 1.2. This example is for a flight reservation “ related Web service, which can be used both to query flights available on a particular date and time between a specific origin city and a destination as well as to make a reservation for a specific flight identified in terms of its flight number, origin/destination city names , and the departure data and time.

start figure
 <?xml version="1.0" encoding="UTF-8"?>  <definitions name="TicketAgent"      targetNamespace="http://airline.wsdl/ticketagent/"      xmlns="http://schemas.xmlsoap.org/wsdl/"      xmlns:tns="http://airline.wsdl/ticketagent/"      xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsd1="http://airline/">      <import location="TicketAgent.xsd" namespace="http://airline/"/>      <message name="listFlightsRequest">          <part name="depart" type="xsd:dateTime"/>          <part name="origin" type="xsd:string"/>          <part name="destination" type="xsd:string"/>      </message>      <message name="listFlightsResponse">          <part name="result" type="xsd1:ArrayOfString"/>      </message>      <message name="reserveFlightRequest">          <part name="depart" type="xsd:dateTime"/>          <part name="origin" type="xsd:string"/>          <part name="destination" type="xsd:string"/>          <part name="flight" type="xsd:string"/>      </message>      <message name="reserveFlightResponse">          <part name="result" type="xsd:string"/>      </message>      <portType name="TicketAgent">          <operation name="listFlights" parameterOrder="depart origin destination">              <input message="tns:listFlightsRequest" name="listFlightsRequest"/>              <output message="tns:listFlightsResponse" name="listFlightsResponse"/>          </operation>          <operation name="reserveFlight" parameterOrder="depart origin destination  flight">              <input message="tns:reserveFlightRequest" name="reserveFlightRequest"/>              <output message="tns:reserveFlightResponse" name="reserveFlightResponse"/>          </operation>      </portType>  </definitions> 
end figure

Figure 2.9: An example of a WSDL definition of a Web service, in this case a Web service for airline reservation applications, as shown in the W3C specification for WSDL Version 1.2.

The goal of WSDL is to ensure that automated processes (e.g., e-business applications running on client PCs) can automatically determine the exact networking capabilities of remote systems (e.g., mainframe) without human intervention or prior definitions. The key WSDL constructs, per the current WSDL specification available at w3.org, are as follows :

  1. WSDL Types ”a container for data-type definitions using some type of system

  2. Message ”an abstract, typed definition of the data being communicated

  3. Operation ”an abstract description of an action supported by the service

  4. Port type ”an abstract set of operations supported by one or more endpoints

  5. Binding ”a concrete protocol and data format specification for a particular port type

  6. Port ”a single endpoint defined as a combination of a binding and a network address

  7. Service ”a collection of related endpoints (or port types)

Web Services[c] Theory and Practice
Web Services[c] Theory and Practice
ISBN: 1555582826
Year: 2006
Pages: 113

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net