Example: Matching a WS-Notification publication and subscription through a message content filter

This example XML code illustrates message content filtering by using XPath selectors.

Example

In this example a business, represented by a NotificationConsumer application, wants to be notified of bank transfers of over $1,000,000. The monitoring application subscribes on behalf of the NotificationConsumer specifying a valid XPath Version 1.0 message content filter, in the following WS-Notification subscribe message:

<wsnt:Subscribe>
  <wsnt:ConsumerReference>
    wsa:EndpointReference
  </wsnt:ConsumerReference>
  <wsnt:Filter>
    [ <wsnt:TopicExpression Dialect="xsd:anyURI"> 
        {any} ?
      </wsnt:TopicExpression> |
      <wsnt:ProducerProperties Dialect="xsd:anyURI"> 
        {any} ?
      </wsnt:ProducerProperties> |
      <wsnt:MessageContent Dialect="xsd:anyURI"> 
        /bankTransfer[value %gt; 1,000,000]
      </wsnt:MessageContent> |
      {any} *
    ] *
  </wsnt:Filter> ?
  <wsnt:InitialTerminationTime> 
    [xsd:dateTime | xsd:duration]
  </wsnt:InitialTerminationTime> ?
  <wsnt:SubscriptionPolicy>
    [ <wsnt:UseRaw/> |
      {any}
    ] *
  </wsnt:SubscriptionPolicy> ?
  {any}*
</wsnt:Subscribe>

The WS-Notification service stores the subscription and its filter.

Another WS-Notification application then publishes a notification in which the message body contains the following information:

<bankTransfer origin="123456 87654321" target="224466 88664422">
  <originName>IBM Corporation</originName>
  <targetName>Matt Roberts</targetName>
  <date>02/02/2006</date>
  <value currency="USD">100,000,000</value>
</bankTransfer>

The WS-Notification service in the application server matches this publication to the earlier subscription and delivers the notification to the consumer specified in the subscription.

Reference topic    

Terms of Use | Feedback

Last updated: Oct 20, 2010 11:50:58 PM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=compass&product=was-base-iseries&topic=rjwsn_ex_sub
File name: rjwsn_ex_xpath.html