WS Notification and WS Topics in the WS Resources Framework
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 third of a multi-part series, we cover the use of notifications and topics. 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).
WS Notification and WS Topics in the WS Resources Framework - The Subscription WS-Resource (Page 3 of 6 )
WS-Notification models a subscription as a WS-Resource. The subscription is a stateful resource that is created by a subscribe request and that uses operations defined by WS-ResourceLifetime (see the section "Resource Lifetime") to manage the lifetime of the subscription.
The Subscription WS-Resource is associated with a Web service implementing the SubscriptionManagerportType. This portType defines a collection of resource properties corresponding to the components in the subscribe request, allowing the requestor to use WS-ResourceProperties operations to read and write the values of subscription-related resource properties. This portType also defines a creationTime resource property that records when the subscription was created.
The SubscriptionManager also supports operations defined by WS-ResourceLifetime, to give requestors the ability to terminate the resource. So, for example, if The Skateboard Warehouse was no longer interested in notifications associated with their PurchaseOrder WS-Resource, they could send a destroy operation to the SubscriptionManager (remembering to use the implied resource pattern to identify the subscription WS-Resource). Of course, the requestor may also use the time-based or scheduled termination mechanism specified by WS-ResourceLifetime to manage the lifetime of the subscription resource.
The complete collection of resource properties defined by a Subscription WS-Resource is as follows:
ConsumerReference—The EPR to the consumer that receives notification messages associated with this subscription.
TopicExpression—The expression that indicates the set of topics associated with this subscription.
UseNotify—Determines if the notification message is sent with additional meta-data.
Precondition—The precondition associated with the subscription.
Selector—The selector or filter associated with the subscription.
SubscriptionPolicy—The policies associated with the subscription.
CreationTime—The time the subscription was created.
CurrentTime, TerminationTime—Defined by WS-ResourceLifetime. These resource properties describe the lifetime of a subscription.
Note that most of the values of these resource properties are derived from the subscribe request message. A requestor would use operations defined by WS-ResourceProperties (included as part of the SubscriptionManager portType) to read and write the values of these resource properties.
The SubscriptionManagerportType also defines a pauseSubscription operation and a resumeSubscription operation. These operations work to stop and restart the process of sending notification messages to the notification consumer based on this subscription. If a requestor wishes to temporarily halt the sending of notification messages based on this subscription, it sends a pauseSubscription request message to the SubscriptionManager Web service associated with the subscription. To resume sending messages, the requestor sends a resumeSubscription request.