Home arrow Web Services arrow Page 3 - Introducing the Implied Resource Pattern
WEB SERVICES

Introducing the Implied Resource Pattern


This article continues our discussion of the WS-Resource Framework, a set of proposed standards that formalizes the relationship between Web services and state. In this part, the second of a multi-part series, we start with the implied resource pattern. It is excerpted from chapter 8 of the book 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: 4 stars4 stars4 stars4 stars4 stars / 6
July 06, 2006
TABLE OF CONTENTS:
  1. · Introducing the Implied Resource Pattern
  2. · Modeling Resource Properties
  3. · Resource Property Operations
  4. · GetResourceProperty
  5. · QueryResourceProperties
  6. · SetResourceProperties
  7. · Combining the SetResourceProperties Components

print this article
SEARCH DEVARTICLES

Introducing the Implied Resource Pattern - Resource Property Operations
(Page 3 of 7 )

WS-ResourceProperties defines four operations related to querying and updating resource properties values: GetResourceProperty, GetMultipleResourceProperties, QueryResourceProperties, and SetResourceProperties. These provide simple, standardized access to the resource properties values of a WS-Resource. Nothing prevents the designer from specifying additional operations that also read or change the WS-Resource's state. However, by defining simple, standardized access, WS-ResourceProperties enables common tooling and better composability of Web services. Let's examine how SkatesTown uses these operations.

Although these operations are defined in the WS-ResourceProperties specifications, SkatesTown includes them in its WSDL definition of its POPortType definition by copying and pasting the WSDL operations. Of course, SkatesTown uses the WSDL import element to allow these copied operations to refer to the WSDL messages and other WSDL elements defined by WS-ResourceProperties. Listing 8.2 shows the new POSubmission WSDL, which incorporates the WS-ResourceProperties concepts.

Listing 8.2 ResourceProperties Operations in the POPortType

<?xml version="1.0" ?>
<wsdl:definitions name="PurchaseOrder"
targetNamespace=
"http://www.skatestown.com/services/interfaces/
poResource.wsdl" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:po="http://www.skatestown.com/ns/po" xmlns:poR="http://www.skatestown.com/services/
interfaces/poResource.wsdl" xmlns:poRP="http://www.skatestown.com/ns/
poResourceProperties" xmlns:inv="http://www.skatestown.com/ns/invoice" xmlns:wsrp="http://www.ibm.com/xmlns/stdwip/
web-services/WS-ResourceProperties" xmlns:wsrl="http://www.ibm.com/xmlns/stdwip/
web-services/WS-ResourceLifetime" xmlns:soap="http://schemas.xmlsoap.org/wsdl/
soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/"> <wsdl:import namespace= "http://www.ibm.com/xmlns/stdwip/web-services/
WS-ResourceProperties" .../> <wsdl:import namespace= "http://www.ibm.com/xmlns/stdwip/web-services/
WS-ResourceLifetime" ... /> <!-- Type definitions --> <wsdl:types> <xsd:schema targetNamespace= "http://www.skatestown.com/services/
interfaces/poResource.wsdl"> ... <xsd:element name="ErrorMessage"
type="xsd:string" /> <xsd:element name="POResourceID"
type="xsd:positiveInteger" /> </xsd:schema> </wsdl:types> <!-- Message definitions --> <wsdl:message name="ErrorMessage"> <wsdl:part name="ErrorMessage"
element="poR:ErrorMessage"/> </wsdl:message> <wsdl:message name="GetInvoiceRequest" /> <wsdl:message name="GetInvoiceResponse" > <wsdl:part name="GetInvoiceRequest"
element="inv:invoice" /> </wsdl:message> <!-- Port type definitions --> <wsdl:portType name="POPortType" wsrp:ResourceProperties=
"poRP:poResourceProperties"> <wsdl:operation name="getInvoice"> <wsdl:input name="GetInvoiceRequest" message="poR:GetInvoiceRequest" /> <wsdl:output name="GetInvoiceResponse" message="poR:GetInvoiceResponse" /> <wsdl:fault name="NoInvoiceFault" message="poR:ErrorMessage" /> </wsdl:operation> <!-- ========== extends wsrp:GetResourceProperty
============ --> <wsdl:operation name="GetResourceProperty"> <wsdl:input name="GetResourcePropertyRequest" ... </wsdl:operation> <!-- ===== extends
wsrp:GetMultipleResourceProperties ======= --> <wsdl:operation name=
"GetMultipleResourceProperties"> <wsdl:input name=
"GetMultipleResourcePropertiesRequest" ... </wsdl:operation> <!-- ===== extends wsrp:SetResourceProperties
============ --> <wsdl:operation name="SetResourceProperties"> <wsdl:input name=
"SetResourcePropertiesRequest" ... </wsdl:operation> <!-- ======= extends wsrp:QueryResourceProperties
=========== --> <wsdl:operation name="QueryResourceProperties"> ... </wsdl:operation> </wsdl:portType> </wsdl:definitions>

This WSDL shows the definition for the POPortType. This definition combines an application-specific operation (GetInvoice) with WS-ResourceProperties–specific operations copied from the WS-ResourceProperties WSDL.

We can examine the details of the WS-ResourceProperties operations in the context of a PurchaseOrder WS-Resource instance. In particular, we can examine the situation where the client, The Skateboard Warehouse, has a WS-Resource–qualified endpoint reference, as shown in Figure 8.1, that it got in response to an invocation of SkatesTown's POSubmission service. The WS-Resource pointed to by that endpoint reference has resource property values as shown in Listing 8.1.


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