Network Deployment (Distributed operating systems), v8.0 > Develop and deploying applications > Develop web services - Notification (WS-Notification)
Develop applications that use WS-Notification
We can code a single application to undertake several WS-Notification tasks. These topics provide sample code for common tasks that your WS-Notification applications can perform.
Most of these examples use the Java API for XML-based remote procedure call (JAX-RPC) APIs and WAS APIs and SPIs. These JAX-RPC examples can interact successfully with v6.1 or v7.0 WS-Notification service points. However to use WS-Notification with policy sets, for example to enable composition with WS-ReliableMessaging, then your WS-Notification applications must be encoded to use the Java API for XML-based Web Services (JAX-WS) programming model and must interact with v7.0 WS-Notification service points. If you are new to programming JAX-WS client applications, see the following topics:
- JAX-WS
- JAX-WS client programming model
- Implement static JAX-WS web services clients
- Write JAX-WS applications for WS-Notification
- Web services hints and tips: JAX-RPC versus JAX-WS, Part 1
If we have an existing v6.1 WS-Notification configuration, and to use WS-Notification with policy sets, work through the following tasks:
- Migrate a v6.1 WS-Notification configuration from WAS v6.1 to v7.0 or later.
- Prepare a migrated v6.1 WS-Notification configuration for reliable notification.
- Configure WS-Notification for reliable notification.
Your applications can also use WS-Notification to receive event notifications generated by other clients of the service integration bus such as JMS clients. This is described in Topology for WS-Notification as an entry or exit point to the service integration bus and Provide access for WS-Notification applications to an existing bus topic space. For information about developing applications for a mixed clients solution, including cross-streaming from a JMS client, see Interacting with JMS message types.
A single application can be coded to undertake several WS-Notification tasks. Use the examples to help you code these tasks into your WS-Notification applications.
For an overview of how applications can use the notification broker, see WS-Notification: How client applications interact at runtime.
WS-Notification applications divide into two broad types: those that expose a Web service endpoint (for example a WS-Notification consumer application that receives notifications of stock valuation changes), and those that do not expose a web service endpoint (for example applications that generate notifications of stock valuation changes). For broad guidance on the steps you take to develop each of these application types, see the following topics:
- Write a WS-Notification application that exposes a web service endpoint.
- Write a WS-Notification application that does not expose a web service endpoint.
Rather than receiving all messages on a topic to which we have subscribed, your consuming application can use XML Path (XPath) selectors to filter the messages based upon the contents of each message as described in Filter the message content of publications.
The code examples listed in this topic use the following WAS APIs and SPIs:
com.ibm.websphere.sib.wsn.AbsoluteOrRelativeTime; com.ibm.websphere.sib.wsn.CreatePullPoint; com.ibm.websphere.sib.wsn.CreatePullPointResponse; com.ibm.websphere.sib.wsn.Filter; com.ibm.websphere.sib.wsn.GetMessages; com.ibm.websphere.sib.wsn.GetMessagesResponse; com.ibm.websphere.sib.wsn.NotificationMessage; com.ibm.websphere.sib.wsn.TopicExpression; com.ibm.websphere.webservices.soap.IBMSOAPFactory; com.ibm.websphere.wsaddressing.EndpointReference; com.ibm.websphere.wsaddressing.WSAConstants; com.ibm.wsspi.wsaddressing.EndpointReferenceManager;
Procedure
- For examples of client applications, see the following topics:
- Example: Subscribing a WS-Notification consumer.
- Example: Pausing a WS-Notification subscription.
- Example: Publishing a WS-Notification message.
- Example: Creating a WS-Notification pull point.
- Example: Getting messages from a WS-Notification pull point.
- Example: Registering a WS-Notification publisher.
- For example XML code illustrating message content filtering by using XPath selectors, see Filter the message content of publications.
- For an example WSDL document describes a web service that implements the NotificationConsumer portType, see Example: Creating a Notification consumer web service skeleton.
- Write a WS-Notification application that exposes a web service endpoint
Write a Java EE application, containing a web service definition, that can be deployed to the application server and act as a NotificationProducer, NotificationConsumer or demand-based publisher.
- Write a WS-Notification application that does not expose a web service endpoint
Write a Java EE application that can be run outside of the application server to make web service invocations against an external web service. This application acts as a lightweight publisher, or a pull type consumer by invoking web service operations against another web service such as the NotificationBroker provided by WAS.
- Filter the message content of publications
Rather than receiving all messages on a topic to which we have subscribed, your consuming application can use XML Path (XPath) selectors to filter the messages based upon the contents of each message. This content-based subscription gives greater flexibility in defining the type of information to receive, the applications can use it to avoid responsibility for their own filtering, and it improves performance by not flowing messages unnecessarily from the server to the application.
- Example: Subscribing a WS-Notification consumer
Use this task to write the code for a JAX-RPC client acting in the publisher registration role, registering a publisher (producer) application with a broker, based on the example code extract provided.
- Example: Pausing a WS-Notification subscription
Use this task to write the code for a JAX-RPC client acting in the subscriber role, pausing a subscription for a consumer application, based on the example code extract provided.
- Example: Publishing a WS-Notification message
Use this task to write the code for a publisher client application that can publish a notification message to a broker, based on the example code extract provided.
- Example: Creating a WS-Notification pull point
Use this task to write the code for a JAX-RPC subscriber client. This client creates a pull point for use by consumer applications that use pull style notifications.
- Example: Getting messages from a WS-Notification pull point
Use this task to write the code for a JAX-RPC client acting in the pull style consumer role, requesting messages from a pull point, based on the example code extract provided.
- Example: Registering a WS-Notification publisher
Use this task to write the code for a subscriber client application that can subscribe a consumer application with a broker, based on the example code extract provided.
- Example: Creating a Notification consumer web service skeleton
Use this example when creating a web service that implements the NotificationConsumer portType defined by the Web Services Base Notification specification.
WS-Notification
WS-Notification: How client applications interact at runtime
WS-Notification topologies
WS-Notification: Overview
Use WS-Notification for publish and subscribe messaging for web services
Secure WS-Notification
Write a WS-Notification application that exposes a web service endpoint
Write a WS-Notification application that does not expose a web service endpoint
Filter the message content of publications
Related
Reference: Generated API documentation
http://www.ibm.com/developerworks/websphere/techjournal/0811_partridge/0811_partridge.html
http://www.ibm.com/developerworks/library/ar-wsnpat/
http://www.ibm.com/developerworks/webservices/library/ws-tip-jaxwsrpc.html
WS-Notification troubleshooting tips
WS-Notification roles and goals