Network Deployment (Distributed operating systems), v8.0 > Develop and deploying applications > Develop web services - Notification (WS-Notification) > Develop applications that use WS-Notification
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.
This example is based on using the Java API for XML-based remote procedure calls (JAX-RPC) APIs with code generated by using the WSDL2Java tool (run against the Notification Broker WSDL generated as a result of creating your WS-Notification service point) and WAS APIs and SPIs.
In WAS there are two implementations of the WS-Notification service: v6.1 and v7.0. This JAX-RPC example 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
To write the code for a JAX-RPC client acting in the subscriber role, creating a pull point for use by a consumer application that is to use pull style notifications, complete the following steps, referring to the example code extract for further information.
Procedure
- Look up the JAX-RPC service. The JNDI name is specific to your web services client implementation.
- Get a stub for the port on which to invoke operations.
- Create the request information.
- Invoke the CreatePullPoint operation by calling the associated method on the stub.
- Retrieve the reference to the pull point from the response.
- Retrieve any additional information from the response.
Example
The following example code describes a JAX-RPC client acting in the subscriber role, creating a pull point for use by a consumer application that is to use pull style notifications:
// Look up the JAX-RPC service. The JNDI name is specific to your web services client implementation InitialContext context = new InitialContext(); javax.xml.rpc.Service service = (javax.xml.rpc.Service) context.lookup( "java:comp/env/services/NotificationBroker"); // Get a stub for the port on which to invoke operations NotificationBroker stub = (NotificationBroker) service.getPort(NotificationBroker.class); // Create the request information. SOAPElement[] optionalInformation = null; CreatePullPoint cpp = new CreatePullPoint(optionalInformation); // Invoke the CreatePullPoint operation by calling the associated method on the stub CreatePullPointResponse response = stub.createPullPoint(cpp); // Retrieve the reference to the pull point from the response EndpointReference pullPointEPR = response.getPullPoint(); // Retrieve any additional information from the response SOAPElement[] additionalInformation = response.getElements();
JAX-RPC
WS-Notification
Use WS-Notification for publish and subscribe messaging for web services
Secure WS-Notification
Related
WSDL2Java command
WS-Notification troubleshooting tips