CH 5
CH 5
CH 5
Chapter 5
Describing Web services
Principles & Technology
Web Services:
Mike P. Papazoglou
[email protected]
Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008
Slide 5.2
Topics
Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008
Slide 5.3
Topics
Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008
Slide 5.5
Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008
Slide 5.6
WSDL as a contract
• A Web service description in WSDL is
an XML document that describes the
mechanics of interacting with a
particular Web service.
• It is inherently intended to constrain
both the service provider and the
service requestor that make use of
that service. This implies that WSDL
represents a “contract” between the
service requestor and the service
provider
• WSDL is platform and language
independent and is used primarily (but
not exclusively) to describe SOAP-
enabled services. Essentially, WSDL
is used to describe precisely
– what a service does, i.e., the operations the
service provides,
– where it resides, i.e., details of the protocol-
specific address, e.g., a URL, and
– how to invoke it, i.e., details of the data
formats and protocols necessary to access the
service’s operations.
Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008
Slide 5.7
Characteristics of WSDL
Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008
Slide 5.8
Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008
Slide 5.10
<types> element
Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008
Slide 5.13
<message> element
• The <message> element describes the payload of a message used by a web
service. A message consists of <part> elements, which are linked to <types>
elements.
• In Listing 1, the PurchaseOrder service defines two <message> elements to
describe the parameters and return values of that service.
– POMessage (also below) describes the input parameters of the service, while
– InvMessage represents the return (output) parameters.
<!-- message elements that describe input and output parameters for the
PurchaseOrderService -->
<!--input message -->
<wsdl:message name="POMessage">
<wsdl:part name="PurchaseOrder" type="tns:POType"/>
<wsdl:part name="CustomerInfo" type="tns:CustomerInfoType”/>
RPC-style
</wsdl:message> message
<! -- outputput message -->
<wsdl:message name="InvMessage">
<wsdl:part name="Invoice" type="tns:InvoiceType"/>
</wsdl:message>
<!-- message element that describes input and output parameters -->
<wsdl:message name="POMessage"> Document-style
<wsdl:part name="PurchaseOrder" element="tns:PurchaseOrder"/>
</wsdl:message> message
Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008
Slide 5.14
WSDL Implementation
Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008
Slide 5.16
service-interface
service-implementation
Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008
Slide 5.17
<wsdl:definitions> . …
<import namespace="http://supply.com/PurchaseService/wsdl"
location="http://supply.com PurchaseService/wsdl/PurchaseOrder-interface.wsdl"/>
<!-- location of WSDL PO interface from Listing-1-->
<!-- wsdl:binding states a serialisation protocol for this service -->
<!-- type attribute must match name of portType element in Listing-1-->
<wsdl:binding name="PurchaseOrderSOAPBinding"
type="tns:PurchaseOrderPortType">
<!-- furthur specify that the messages in the wsdl:operation use SOAP -->
<wsdl:input> map the abstract
<soapbind:body use="literal" input and output messages
namespace="http://supply.com/PurchaseService/wsdl"/> to these concrete messages
</wsdl:input>
<wsdl:output>
<soapbind:body use=“literal" Listing 2:
namespace="http://supply.com/ PurchaseService/wsdl"/>
</wsdl:output> Example of WSDL
implementation
</wsdl:operation>
</wsdl:binding>
Service name
<wsdl:service name=“PurchaseOrderService">
<wsdl:port name=“PurchaseOrderPort" binding="tns:PurchaseOrderSOAPBinding">
<!-- give the binding a network endpoint address or URI of service --> Network address of service
<soapbind:address location="http://supply.com:8080/PurchaseOrderService"/>
</wsdl:port>
</wsdl:service>
Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008
</wsdl:definitions>
Slide 5.18
Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008
Slide 5.19
<wsdl:input>
<soapbind:body use=“literal"
namespace="http://supply.com/PurchaseOrderService/wsdl"/>
</wsdl:input>
<wsdl:output>
<soapbind:body use=“literal"
namespace="http://supply.com/ PurchaseOrderService/wsdl"/>
</wsdl:output>
</wsdl:operation> Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008
</wsdl:binding>
Slide 5.20
Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008
Slide 5.21
Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008
Slide 5.22
Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008
Slide 5.23
Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008
Slide 5.24
One-way operation
<!-- portTyepe element describes the abstract interface of a Web service -->
<wsdl:portType name="SubmitPurchaseOrder_PortType">
<wsdl:operation name="SubmitPurchaseOrder">
<wsdl:input name="order" message="tns:SubmitPurchaseOrder_Message"/>
</wsdl:operation>
</wsdl:portType>
Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008
Slide 5.25
Request/response operation
Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008
Slide 5.26
Notification operation
Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008
Slide 5.27
Solicit/response operation
Michael P. Papazoglou, Web Services, 1st Edition, © Pearson Education Limited 2008