- Forward


Web Services Definition Language (WSDL)
An Introduction


Prof. David Bernstein
James Madison University

Computer Science Department
bernstdh@jmu.edu

Print

Overview
Back SMYC Forward
  • Description:
    • An XML grammar for describing network services as collections of communication endpoints capable of exchanging messages
  • History:
    • Originally designed by IBM, Microsoft, and Ariba
    • Later submitted to the World Wide Web Consortium (W3C) for standardization
Elements
Back SMYC Forward
type A container for data type definitions (e.g., XSD).
message One or more parts (with its/their associated types).
operation An abstract description of an action.
portType An abstract set of operations.
binding A concrete protocol and data format for a port type.
port A combination of a binding and a network address (i.e., a single endpoint).
service A collection of related endpoints.
Types
Back SMYC Forward

WSDL uses the XSD type system, for example:

<complexType name="Book"> <!-- Either the following group must occur or else the href attribute must appear, but not both. --> <sequence minOccurs="0" maxOccurs="1"> <element name="title" type="xsd:string"/> <element name="firstauthor" type="Person"/> <element name="secondauthor" type="Person"/> </sequence> <attribute name="href" type="uriReference"/> <attribute name="id" type="ID"/> </complexType>
Messages
Back SMYC Forward
  • Components:
    • Messages consist of one or more logical parts
    • Each part is associated with a type
  • Reason for Messages:
    • Each method has exactly one input and one output
    • So each message element has one or more part elements, each of which represents what would be called a parameter in a language like Java
Messages (cont.)
Back SMYC Forward

An Example

<message name="requestFlights"> <part name="time" type="xsd:dateTime"/> <part name="origin" type="xsd:string"/> <part name="dest" type="xsd:string"/> </message> <message name="requestFlightsResponse"> <part name="result" type="xsd:ArrayOfString"/> </message>
Port Types
Back SMYC Forward
  • Defined:
    • A named set of abstract operations and the abstract messages involved
    • Essentially, a Java interface
  • Attributes and Elements:
    • Contain operation elements
    • The name attribute provides a unique name among all port types defined within in the enclosing WSDL document
Operations
Back SMYC Forward
  • Attributes:
    • name
    • parameterOrder (optional)
  • Elements:
    • input (optional)
    • output (optional)
  • Classification of Operations:
    • One-way (i.e., the endpoint receives a message)
    • Request-response (i.e., the endpoint first receives a message and then sends a correlated message)
    • Solicit-response (i.e., the endpoint first sends a message and then receives a correlated message)
    • Notification (i.e., the endpoint sends a message)
Port Types and Operations (cont.)
Back SMYC Forward

An Example

<portType name="TicketAgent"> <operation name="listFlights" parameterOrder="time origin dest"> <input message="requestFlights" name="requestFlights"/> <output message="requestFlightsResponse" name="requestFlightsResponse"/> </operation> </portType>
Bindings
Back SMYC Forward
  • An Observation:
    • A portType element, like an interface in Java, cannot be instantiated
  • Bindings Defined:
    • Provides the information needed to "realize" a portType
    • "Defines message format and protocol details for operations and messages defined by a particular portType"
  • Common Bindings:
    • HTTP
    • SOAP over HTTP
    • SOAP over SMTP
Bindings (cont.)
Back SMYC Forward

An Example

<wsdl:binding name="TicketAgencyBinding" type="TicketAgent"> <soap:binding style="document" transport="http://schemas/xmlsoap.org/soap/http"/> <wsdl:operation name="listFlights"> <wsdl:input> <soap:body use="literal" /> </wsdl:input> <wsdl:output> <soap:body use="literal" /> </wsdl:output> </wsdl:operation> </wsdl:binding>
Ports
Back SMYC Forward
  • Defined:
    • A port elements defines an individual endpoint by specifying a single address for a binding
  • An Example:
    • <port binding="TicketAgentBinding" name="TicketAgentPort"> <soap:address location="http://www.ticketdog.com/soap/"> </port>
Services
Back SMYC Forward
  • Defined:
    • A service element groups a set of related port elements together
  • Ports within a Service:
    • None of the ports communicate with each other (e.g. the output of one port is not the input of another)
    • If a service has several ports that share a port type, but employ different bindings or addresses, the ports are alternatives
There's Always More to Learn
Back -