Web Services Definition Language (WSDL)
An Introduction |
Prof. David Bernstein |
Computer Science Department |
bernstdh@jmu.edu |
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. |
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>
message
element has one
or more part
elements, each of which represents
what would be called a parameter in a language like JavaAn 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>
interface
operation
elementsname
attribute provides a unique name
among all port types defined within in the enclosing
WSDL documentname
parameterOrder
(optional)input
(optional)output
(optional)An Example
<portType name="TicketAgent"> <operation name="listFlights" parameterOrder="time origin dest"> <input message="requestFlights" name="requestFlights"/> <output message="requestFlightsResponse" name="requestFlightsResponse"/> </operation> </portType>
portType
element, like an
interface
in Java, cannot be instantiatedportType
portType
"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>
port
elements defines an individual
endpoint by specifying a single address for a binding<port binding="TicketAgentBinding" name="TicketAgentPort"> <soap:address location="http://www.ticketdog.com/soap/"> </port>
service
element groups a set of related
port
elements together