Home arrow Web Services arrow Page 5 - WS Notification and WS Topics in the WS Resources Framework

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).

Author Info:
By: Sams Publishing
Rating: 5 stars5 stars5 stars5 stars5 stars / 6
July 13, 2006
  1. · WS Notification and WS Topics in the WS Resources Framework
  2. · Subscribing for Notification
  3. · The Subscription WS-Resource
  4. · Topics and Topic Spaces
  5. · TopicPathExpressions
  6. · Rounding Out the XML Model of Topics: aliasRef

print this article

WS Notification and WS Topics in the WS Resources Framework - TopicPathExpressions
(Page 5 of 6 )

To this point, we've only mentioned topic expressions in passing. Topic expressions appear in subscribe requests and several other places in WS-Notification. They can contain a wide variety of expression types, from simple, QName-based topic names to path expressions (like hierarchical file paths in a computer's filesystem) to rich wild- card-enabled expression languages. The type of expression is determined by the dialect attribute of a topic expression. The dialect attribute contains a URI that identifies the language used by the topic expression. WS-Topics defines several dialects, and their standard URIs are specified in that document.

The simplest topic expression dialect, identified by the URI http://www.ibm.com/xmlns/stdwip/web-services/WS-
, can contain only QNames of root topics. This language is quite limited in that it can only identify root topics. However, in many circumstances, simple (nonhierarchical) topic spaces are sufficient. Here is an example simple topic expression that identifies the orderPlacement topic:

<wsnt:TopicExpression dialect=
WS-Topics/TopicExpression/ simple"> crm:orderPlacement </wsnt:TopicExpression>

The second topic expression dialect defined by WS-Topics is a straightforward path language that's similar to file paths in hierarchical directory structures. This path-based dialect is identified by the URI http://www.ibm.com/xmlns/stdwip/web-services/WS-
. This is a so-called concrete topic expression dialect because expressions in this dialect identify exactly one topic. This is more powerful than the simple dialect, in that child topics can be identified. In this dialect, topic expressions are combinations of topic names and topic paths (topic names separated by slashes, /, to denote hierarchical parent topic/child topic structures). Note that this dialect builds on the simple dialect: The concrete topic expression dialect also allows the QName expressions found in the simple dialect.

Here's an example concrete topic expression, identifying the VIPComplaint child topic of the complaint topic:

<wsnt:TopicExpression dialect=
WS-Topics/TopicExpression/ concreteTopicPath"> crm: telephoneContact/complaint/VIPComplaint </wsnt:TopicExpression>

A third topic expression dialect defined by WS-Topics is the full topic expression dialect. The full topic expression dialect builds on the concrete topic dialect by adding wildcard (*) characters and including a conjunction (|) to allow you to express the logical or of two topic expressions. With a topic expression using this full dialect, you can specify one or more topics in a single expression:

  • Topic expressions containing a wildcard (*) may identify any number of topics. The wildcard can appear anywhere in the topic expression, either at the beginning of the topic expression, matching any root topic; or part way through a topic expression, matching any child topic at a particular level in the hierarchy.

  • A topic expression consisting just of the * character matches any topic. If this were the parameter of a subscribe request, it would suggest that the subscriber was interested in all topics supported by that notification producer.

  • A topic expression containing a wildcard after a / symbol indicates a match for all the topics at a particular level in the topic tree. For example, the topic expression crm:telephoneContact/* matches all the child topics of crm:telephoneContact. The expression crm:telephoneContact/* doesn't match the crm:telephoneContact topic itself. To match an entire subtree of topics rooted at a particular node, you use the //. construct. So the topic expression crm:telephoneContact//. matches all the topics in the entire topic tree rooted at crm:telephoneContact.

  • The | character evaluates to the set union of the topics from both expressions. This allows a subscriber to use one subscription to receive notifications from a combination of different topics. For example, if the subscriber wanted to subscribe to receive notifications on the crm:telephoneContact and the crm:emailContact topics, they would use the following topic expression: crm:telephoneContact | crm:emailContact.

TopicExpressions and XPath - Although the authors of WS-Topics could have chosen XPath as the language to describe topic paths, it turned out that doing so wasn't straightforward. Early design attempts to make the topic expression language simple XPath (or a subset thereof) turned out to require that the topic space XML document look extremely awkward. So, the designers faced a choice: either specify an XPath subset as the topic expression language and have a very awkward-looking topic space document, or choose to have a straightforward-looking topic model in XML and develop a simple, path-based expression language. On balance, the designers chose the lesser of two evils.

blog comments powered by Disqus

- Dealing with Loose Coupling in a Service-Ori...
- Loose Coupling in a Service-Oriented Archite...
- Safety, Idempotence, and the Resource-Orient...
- The Resource-Oriented Architecture in Action
- Features of the Resource-Oriented Architectu...
- The Resource-Oriented Architecture
- Getting Started with Flex
- Automated Billing and Faxing for the Web
- An Introduction to Web Services
- The Foundations of Web Services: From Novice...
- Web Services Reengineering: Finishing Touches
- Fault Handling with Web Services
- Flow and Web Services
- Process Lifecycles and Web Services
- Business Processes and Web Services

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials