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
<wsrp:QueryExpression dialect="URI">
xsd:any
</wsrp:QueryExpression>
And the language used in the content of the query is indicated by the URI value of the dialect attribute. The WS-ResourceProperties specification defines two expression dialect URIs: XPath 1.0 (http://www.w3.org/TR/1999/REC-xpath-19991116) and XPath 2.0 (http://www.w3.org/TR/2003/WD-xpath20-20031112).
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
<soap:Envelope
...
<poRP:POResourceID>43871</poRP:POResourceID>
</soap:Header>
<soap:Body>
<wsrp:QueryResourcePropertiesResponse>
false
</wsrp:QueryResourcePropertiesResponse>
</soap:Body>
</soap:Envelope>
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.
Next: SetResourceProperties >>
More Web Services Articles
More By Sams Publishing
|
This article 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). Check it out today at your favorite bookstore. Buy this book now.
|
|