Notifications and Resources in the WS-Resource Framework
This article concludes our discussion of the WS-Resource Framework, a set of proposed standards that formalizes the relationship between Web services and state. In this part, we finish covering notifications and go into greater detail about resources. 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).
Notifications and Resources in the WS-Resource Framework - Notification of WS-Resource Termination (Page 5 of 6 )
WS-ResourceLifetime also standardizes the way WS-Notification can be used to inform interested parties about the termination of a WS-Resource. There is a standardized topic (recall the topics concept we discussed in the section "Topics") in the WS-ResourceLifetime namespace ResourceTermination. Requestors can use this topic to subscribe for a notification message when a WS-Resource of interest is terminated.
In order for this facility to work, the following pieces must be in place:
The Web service component of the WS-Resource must support the notification producer operations (for example, the subscribe operation).
The Web service component of the WS-Resource must include the wsrl:ResourceTermination topic in its list of topics (recall the Topics resource property described in the section "Resource Properties of a Notification Producer").
SkatesTown's POPortType Web service supports generating the notification messages on the ResourceTermination topic as described earlier. The Skateboard Warehouse can issue a subscribe operation as follows to register interest in when a PurchaseOrder WS-Resource is destroyed:
<!-- the reference property to id the PO -->
services/WS-Topics/TopicExpression/ simple"> wsrl:ResourceTermination </wsnt:TopicPathExpression>... </wsnt: Subscribe>
When the PurchaseOrder WS-Resource is terminated, a notification message will be delivered to the notification consumer indicating (among other information) the time the WS-Resource was terminated and the reason for its termination. WS-ResourceLifetime specifies that the notification message must contain an element of the following form: