JMU
Web Services Definition Language (WSDL)
An Introduction


Prof. David Bernstein
James Madison University

Computer Science Department
bernstdh@jmu.edu


Overview
Elements
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

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
Messages (cont.)

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
Operations
Port Types and Operations (cont.)

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
Bindings (cont.)

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
Services