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 - QueryResourceProperties (Page 5 of 7 )
The QueryResourceProperties operation was designed to allow applications to issue query expressions, like XPath, against the content of a WS-Resource's resource property document. Although the syntax of QueryResourceProperties allows for any type of query expression, the normal usage is for an XPath version 1.0 expression to be evaluated on the resource properties document. The form of the query element is
Imagine if The Skateboard Warehouse had a collection of outstanding PurchaseOrder WS-Resources, some with SkatesTown and some with other vendors. Although it could group these WS-Resource references together into a collection (such as a ServiceGroup that we'll briefly discuss toward the end of this chapter), imagine for now that the reorder application simply keeps an array of WS-Resource endpoint references to these PurchaseOrder WS-Resources. Now, consider the case where a decision maker wants to get a list of all the pending PurchaseOrders. The application could iterate through the array of endpoint references, issuing the following XPath 1.0 Query:
<soap:Envelope>
...
<!--identify the resource from the EPR --> <poRP:POResourceID>XXXXX</poRP:POResourceID> </soap:Header>
<soap:Body>
<wsrp:QueryResourcePropertiesRequest>
<wsrp:QueryExpression
dialect="http://www.w3.org/TR/1999/
REC-xpath-19991116">
./poRP:status="pending" </wsrp:QueryExpression>
</wsrp:GetMultipleResourcePropertiesRequest>
</soap:Body>
</soap:Envelope>
The application would then aggregate the responses from the query evaluation on each PurchaseOrder WS-Resource. In the case of the PurchaseOrder we've been examining in this section, the status is received, not pending; therefore the response will be
Currently, there is no way for the Web service to communicate which query languages it supports. It would need to be declared using some WS-Policy assertion, but WS-ResourceProperties doesn't specify this WS-Policy grammar.