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 - Rounding Out the XML Model of Topics: aliasRef (Page 6 of 6 )
There is one other topic component we haven't covered: AliasRef. WS-Notification provides a mechanism that allows one topic to alias or point to another topic, perhaps another topic in the same topic tree, a topic in a different topic tree, or a topic in a different topic space. The purpose of an aliasRef topic is to help organize topics when the domain isn't strictly hierarchical. You can see this in the CRM example. The orderPlacement subtopic of telephoneContact is an alias for another topic:
The value of an AliasRef child element is a topic expression that can resolve to potentially multiple topics (of course, depending on the dialect). When a subscriber subscribes to a topic that is an aliasRef, it's the same as if the subscriber subscribed to all the topics the aliasRef topic expression resolves to. In this case, subscribing to the crm:telephoneContact/orderPlacement topic is the same as subscribing to the crm:orderContact topic. But why bother with the aliasRef? One reason comes into play when you consider wildcard topic expressions. Consider the topic expression crm:telephone/*: because of the aliasRef, this expression will pick up notification messages posted to the crm:orderContact topic as well, because the orderPlacement topic aliasRef's that topic.
Resource Properties of a Notification Producer
WS-Notification requires that notification producers must include two resource properties within the XML schema definition of its resource properties document: wsnt:Topic and wsnt:FixedTopicSet.
The wsnt:Topic resource property is a sequence of topic expressions describing one or more topics supported by the notification producer. There can be many topic expressions within any individual wsnt:Topic resource properties element. If a topic is identified by a topic expression in the wsnt:Topic resource property, a subscriber has a reasonable level of assurance that a subscribe request on that given topic is likely to be successful. This isn't a guarantee that a notification consumer will receive a notification message on that topic—for example, a situation may never arise that causes a notification message to be associated with the topic.
In our example of the POPortType, the resource properties document includes the following resource property element:
This indicates that the PurchaseOrder Web service supports (among potentially many other topics) the topic corresponding to value changes in the poRP:status resource property.
The other resource property required on notification producers is wsnt:FixedTopicSet. This resource property is a Boolean and indicates whether the topic set is fixed (that is, whether it's possible that the list of topics within the wsnt:Topics resource property element can change). Certain notification producers are flexible and change the set of topics they support over time (for example, based on the changing needs of its notification consumers). In these cases, FixedTopicSet would be set to false.
Notification producers also include a resource property called TopicExpressionDialects, which contains the URIs of the topic expression dialects they can understand.
Please come back next week for the conclusion of this article.
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.