Home arrow Web Services arrow Web Services Reengineering: Finishing Touches
WEB SERVICES

Web Services Reengineering: Finishing Touches


In the previous five articles, we have reengineered the web services for a sample website and business. In this sixth and final part, we pull it all together. It is excerpted from chapter 12 of Building Web Services with Java: Making sense of XML, SOAP, WSDL, and UDDI, written by Steve Graham et al. (Sams; ISBN: 0672326418).

Author Info:
By: Sams Publishing
Rating: 5 stars5 stars5 stars5 stars5 stars / 7
September 07, 2006
TABLE OF CONTENTS:
  1. · Web Services Reengineering: Finishing Touches
  2. · Listing 12.8 The Complete SkatesTown Business Process
  3. · Advanced Considerations
  4. · Summary

print this article
SEARCH DEVARTICLES

Web Services Reengineering: Finishing Touches
(Page 1 of 4 )

SkatesTown: Putting It All Together

The Web services reengineering project at SkatesTown is now complete. The hard-coded Java implementation of the submitPurchaseOrder Web service has been replaced by a business process, and the external interface of the service has been extended accordingly.

The purchase order BPEL process is a long-running process, and, as such, it represents a stateful Web service. The Web service interface for the purchase order submission now supports fault messages. An additional operation is provided to allow the buyer to cancel a running purchase order. In addition, the process interacts with a Web service provided by SkatesTown's supplier.

Figure 12.7 gives an overview of the BPEL and WSDL artifacts of the SkatesTown business process. The interface of the SkatesTown process and its invoked services is provided by the three WSDL documents in Listings 12.3, 12.4, and 12.5. They show the Web service interfaces of the buyer, the seller, and the supplier, respectively.


Figure 12.7  BPEL and WSDL artifacts for the SkatesTown business process

Listing 12.3 PortType Offered to the Buyer

<?xml version="1.0" ?>
<definitions name="poSubmission" 
targetNamespace="http://www.skatestown.com/
services/interfaces/ poSubmission.wsdl" xmlns:pos="http://www.skatestown.com/
services/interfaces/ poSubmission.wsdl" xmlns:po="http://www.skatestown.com/ns/po" xmlns:inv="http://www.skatestown.com/ns/invoice" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/
wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/"> <!-- Type definitions --> <types> <xsd:schema> <!-- rest of invoice schema definition from
chapter 2 --> <xsd:import namespace=
"http://www.skatestown.com/ns/invoice" schemaLocation="../../ns/invoice.xsd"/> <!-- rest of purchaseOrder schema definition
from chapter 2 --> <xsd:import namespace=
"http://www.skatestown.com/ns/po" schemaLocation="../../ns/po.xsd"/> </xsd:schema> </types> <!-- Message definitions --> <message name="poSubmissionRequest"> <part name="purchaseOrder" element="po:po"/> </message> <message name="poSubmissionResponse"> <part name="invoice" element="inv:invoice"/> </message> <message name="poSubmissionFaultInvalidPO"> <part name="customerID" element="xsd:ID"/> <part name="orderNumber"
element="xsd:positiveInteger"/> </message> <message name="poSubmissionFaultOutOfStock"> <part name="customerID" element="xsd:ID"/> <part name="orderNumber"
element="xsd:positiveInteger"/> </message> <message name="cancelPurchaseOrderRequest"> <part name="purchaseOrder" element="po:po"/> </message> <!-- Port type definitions --> <portType name="poSubmissionPortType"> <operation name="doSubmission"> <input message="pos:poSubmissionRequest"/> <output message="pos:poSubmissionResponse"/> <fault name="invalidPO"
message="pos:poSubmissionFaultInvalidPO"/> <fault name="outOfStock"
message="pos:poSubmissionFaultOutOfStock"/> </operation> <operation name="cancelPurchaseOrder"> <input message=
"pos:cancelPurchaseOrderRequest"/> </operation> </portType> </definitions>

Listing 12.4 PortType of SkatesTown's Local Services

<?xml version="1.0" encoding="UTF-8"?>
<definitions name="skatesTown"
targetNamespace="http://www.skatestown.com/
services/interfaces/ skatesTown.wsdl" xmlns:skt="http://www.skatestown.com/
services/interfaces/skatesTown.wsdl" xmlns:pos="http://www.skatestown.com/
services/interfaces/poSubmission.wsdl" xmlns:po="http://www.skatestown.com/ns/po" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/"> <!-- Type definitions --> <types> <xsd:schema> <!-- Imports (message definitions from
external interface: submitPurchaseOrderRequest,
submitPurchaseOrderResponse) --> <xsd:import
namespace="http://www.skatestown.com/ns/po" schemaLocation="../../ns/po.xsd"/> </xsd:schema> </types> <!-- Message definitions --> <message name="validatePurchaseOrderResponse"> <part name="valid" element="xsd:boolean"/> </message> <message name="checkLocalStockResponse"> <part name="available" element="xsd:boolean"/> </message> <!-- Port type definitions --> <portType name="skatestownPortType"> <operation name="validatePurchaseOrder"> <input message="submitPurchaseOrderRequest"/> <output message=
"validatePurchaseOrderResponse"/> </operation> <operation name="checkLocalStock"> <input message="submitPurchaseOrderRequest"/> <output message="checkLocalStockResponse"/> </operation> <operation name="initiateDelivery"> <input message="submitPurchaseOrderRequest"/> </operation> <operation name="createInvoice"> <input message="submitPurchaseOrderRequest"/> <output
message="submitPurchaseOrderResponse"/> </operation> </portType> </definitions>

Listing 12.5 PortTypes Offered and Used by the Supplier

<?xml version="1.0" encoding="UTF-8"?>
<definitions name="orderSupplies"
targetNamespace="http://www.wheelsandboards.com/
services/interfaces/ orderSupplies.wsdl" xmlns:asp="http://www.wheelsandboards.com/
services/interfaces/ orderSupplies.wsdl" xmlns:po="http://www.skatestown.com/ns/po" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2003/
03/addressing" xmlns="http://schemas.xmlsoap.org/wsdl/"> <!-- Type definitions --> <types> <xsd:schema> <!-- Imports (message definitions from
skatestown, ideally, should be shared between
skatestown and wheelsandboards) --> <xsd:import
namespace="http://www.skatestown.com/ns/po" schemaLocation=
"http://www.skatestown.com/ns/po.xsd"/> </xsd:schema> </types> <!-- Message definitions --> <message name="orderSuppliesRequest"> <part name="orderSupplies" element="po:po"/> <part name="endpointReferenceOfSeller" element= "wsa:EndpointReferenceType"/> </message> <message name="orderSuppliesResponse"> <part name="customerID" element="xsd:ID"/> <part name="orderNumber"
element="xsd:positiveInteger"/> </message> <message name="orderSuppliesFault"> <part name="customerID" element="xsd:ID"/> <part name="orderNumber"
element="xsd:positiveInteger"/> </message> <!-- Port type definitions --> <portType name="orderSuppliesPortType"> <operation name="orderSupplies"> <input message="asp:orderSuppliesRequest"/> </operation> </portType> <portType name="orderSuppliesCallbackPortType"> <operation name="orderSuppliesOk"> <input message="asp:orderSuppliesResponse"/> </operation> <operation name="orderSuppliesFailed"> <input message="asp:orderSuppliesFault"/> </operation> </portType> </definitions>

The SkatesTown business process refers to three partnerLinkTypes for the interactions with the buyer, the supplier, and its own internal services. These partnerLinkTypes are defined in the WSDL shown in Listing 12.6.

Listing 12.6 SkatesTown PartnerLinkType Definitions

<?xml version="1.0" encoding="UTF-8"?>
<definitions name="poSubmissionPLT"
targetNamespace="http://www.skatestown.com/
processes/poSubmissionPLT" xmlns:pos="http://www.skatestown.com/
services/interfaces/poSubmission.wsdl" xmlns:skt="http://www.skatestown.com/
services/interfaces/skatesTown.wsdl" xmlns:sup="http://www.wheelsandboards.com/
services/interfaces/ orderSupplies.wsdl" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/
05/partner-link/" xmlns="http://schemas.xmlsoap.org/wsdl/"> <!-- PartnerLinkType definitions --> <plnk:partnerLinkType
name="purchaseOrderPartnerLinkType"> <plnk:role name="seller"> <plnk:portType
name="pos:poSubmissionPortType"/> </plnk:role> </plnk:partnerLinkType> <plnk:partnerLinkType name="localPartnerLinkType"> <plnk:role name="sellerLocal"> <plnk:portType name="skt:skatesTownPortType"/> </plnk:role> </plnk:partnerLinkType> <plnk:partnerLinkType
name="orderSuppliesPartnerLinkType"> <plnk:role name="supplier"> <plnk:portType
name="sup:orderSuppliesPortType"/> </plnk:role> <plnk:role name="seller"> <plnk:portType
name="sup:orderSuppliesCallbackPortType"/> </plnk:role> </plnk:partnerLinkType> <!-- Port type definitions --> <import namespace="http://www.skatestown.com/
services/interfaces/ poSubmission.wsdl" location="../services/interfaces/
poSubmission12.wsdl"/> <import namespace="http://www.skatestown.com/
services/interfaces/ skatesTown.wsdl" location="../services//interfaces/
skatesTown.wsdl"/> <import namespace="http://www.wheelsandboards.com/
services/interfaces/ orderSupplies.wsdl" location="http://www.wheelsandboards.com/
services/interfaces/ orderSupplies.wsdl"/> </definitions>

The correlation set defined as part of the SkatesTown business process names two properties. The WSDL snippet in Listing 12.7 shows the properties and their relationship to WSDL message types.

Listing 12.7 SkatesTown Property and Property Alias Definitions

<?xml version="1.0" encoding="UTF-8"?>
<definitions name="poSubmissionPPA"
targetNamespace="http://www.skatestown.com/
processes/poSubmissionPPA" xmlns:pos="http://www.skatestown.com/services/
interfaces/poSubmission.wsdl" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsbp="http://schemas.xmlsoap.org/ws/2003/
03/business-process/" xmlns="http://schemas.xmlsoap.org/wsdl/"> <!-- Property and property alias definitions --> <wsbp:property name="customerID" type="xsd:ID"/> <wsbp:property name="orderNumber"
type="xsd:positiveInteger"/> <wsbp:propertyAlias propertyName="customerID" messageType="pos:poSubmissionRequest" part="purchaseOrder"
query="/billTo/id"/> <wsbp:propertyAlias propertyName="orderNumber" messageType="pos:poSubmissionRequest" part="purchaseOrder" query="/id"/> <wsbp:propertyAlias propertyName="customerID" messageType="pos:poSubmissionResponse" part="invoice" query="/billTo/id"/> <wsbp:propertyAlias propertyName="orderNumber" messageType="pos:poSubmissionResponse" part="invoice" query="/id"/> <wsbp:propertyAlias propertyName="customerID" messageType=
"pos:poSubmissionFaultInvalidPO" part="customerID"/> <wsbp:propertyAlias propertyName="orderNumber" messageType=
"pos:poSubmissionFaultInvalidPO" part="orderNumber"/> <wsbp:propertyAlias propertyName="customerID" messageType=
"pos:poSubmissionFaultOutOfStock" part="customerID"/> <wsbp:propertyAlias propertyName="orderNumber" messageType=
"pos:poSubmissionFaultOutOfStock" part="orderNumber"/> <wsbp:propertyAlias propertyName="customerID" messageType=
"pos:cancelPurchaseOrderRequest" part="purchaseOrder"
query="/billTo/id"/> <wsbp:propertyAlias propertyName="orderNumber" messageType=
"pos:cancelPurchaseOrderRequest" part="purchaseOrder" query="/id"/> <!-- Port type definitions --> <import namespace="http://www.skatestown.com/
services/interfaces/ poSubmission.wsdl" location="../services/interfaces/
poSubmission12.wsdl"/> </definitions>

Finally, the complete SkatesTown business process is shown in Listing 12.8.


blog comments powered by Disqus
WEB SERVICES ARTICLES

- Dealing with Loose Coupling in a Service-Ori...
- Loose Coupling in a Service-Oriented Archite...
- Safety, Idempotence, and the Resource-Orient...
- The Resource-Oriented Architecture in Action
- Features of the Resource-Oriented Architectu...
- The Resource-Oriented Architecture
- Getting Started with Flex
- Automated Billing and Faxing for the Web
- An Introduction to Web Services
- The Foundations of Web Services: From Novice...
- Web Services Reengineering: Finishing Touches
- Fault Handling with Web Services
- Flow and Web Services
- Process Lifecycles and Web Services
- Business Processes and Web Services

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials