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).
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.2ResourcePropertiesOperations in the POPortType
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.