Writing a Subscription Notification Service  Locate

This section will show you how to implement a subscription notification service. When you create a BEA AquaLogic Service Registry subscription you can specify a notification listener service endpoint as described in Subscriptions in BEA AquaLogic Service Registry. In this chapter, we describe the following use case: The user wants to create a service that will be executed when a subscription notification is sent. The listener notification service will be deployed on the Systinet Server for Java.

The procedure of creating and deploying the subscription notification consist of the following steps:

  1. Create subscription notification service class. Package the notification service class with necessary wsdl, schema, and deployment descriptor files.

  2. Deploy the service notification package with the required BEA AquaLogic Service Registry client packages into Systinet Server for Java.

  3. Create a subscription using the Registry Console.

[Note]Note

We assume BEA AquaLogic Service Registry is installed in REGISTRY_HOME folder and running at http://localhost:8080/, and that

Systinet Server for Java is installed in WASP_HOME folder and running at http://localhost:6060/.

Now we will describe the process in detail:

  1. Create the subscription notification service class shown in Example 14

  2. Compile the ExampleNotificationListener.java using:

    javac -classpath%REGISTRY_HOME%\dist\uddiclient_api_v3.jar;
    %REGISTRY_HOME%\dist\uddiclient_core.jar;
    %REGISTRY_HOME%\dist\uddiclient_subscription_listener_v3.jar;
    %REGISTRY_HOME%\dist\uddiclient_subscription_v3.jar ExampleNotificationListener.java
                
  3. Package the ExampleNotificationListener.class with necessary wsdl, schema and deployment descriptor file as follows:

    1. Create a jar file ExampleNotificationListener.jar with the following structure:

    2. Copy the wsdl and schema files from REGISTRY_HOME/doc/wsdl to the package.

    3. Copy the package.xml file shown in Example 15 to the package.

  4. Deploy the service notification package with required BEA AquaLogic Service Registry client packages into Systinet Server for Java 5.5.

    1. copy %REGISTRY_HOME%\dist\uddiclient_api_v3.jar %WASP_HOME%\app\system\uddi

    2. copy %REGISTRY_HOME%\dist\uddiclient_subscription_v3.jar %WASP_HOME%\app\system\uddi

    3. copy %REGISTRY_HOME%\dist\uddiclient_subscription_listener_v3.jar %WASP_HOME%\app\system\uddi

    4. copy ExampleNotificationListener.jar %WASP_HOME%\app\system\uddi

  5. Shutdown the Systinet Server for Java, delete the WASP_HOME/work directory, and restart the Systinet Server for Java

  6. Create a subscription using the Registry Console.

    See Publishing Subscriptions for instructions on how to create a subscription.

  7. Publish the subscription with the Notification listener type Service endpoint. Enter the Notification listener endpoint as http://your.computer.name.com:6060/ExampleNotificationListener as shown in Figure 11

    Figure 11. Create Subscription

    Create Subscription

Sample Files  Locate

Example 14.  ExampleNotificationListener.java

package com.systinet.subscription;

import org.systinet.uddi.client.subscription.listener.v3.UDDI_SubscriptionListener_PortType;
import org.systinet.uddi.client.subscription.listener.v3.struct.Notify_subscriptionListener;
import org.systinet.uddi.client.v3.UDDIException;
import org.systinet.uddi.client.v3.struct.DispositionReport;

public class ExampleNotificationListener implements UDDI_SubscriptionListener_PortType{

    public DispositionReport notify_subscriptionListener(Notify_subscriptionListener body) 
       throws UDDIException {
            System.out.println(body.toXML());
            DispositionReport result = DispositionReport.DISPOSITION_REPORT_SUCCESS;
            return result;
    }
}

Example 15.  package.xml

<?xml version="1.0" encoding="UTF-8"?>
<package xmlns="http://systinet.com/wasp/package/1.2"
    xsi:schemaLocation="http://systinet.com/wasp/package/1.2 http://systinet.com/wasp/package/1.2"
    targetNamespace="http://my.org" version="1.0"
    name="ExampleNotificationListener" client-package="false" library="false"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:tns="http://my.org"

    xmlns:uddi_subr_v3="urn:uddi-org:subr_v3_binding"
    xmlns:uddiclient_subscription_listener_v3=
       "http://systinet.com/uddi/client/subscription/listener/v3/5.0">

    <dependency ref=
       "uddiclient_subscription_listener_v3:UDDIClient-subscription-listener-v3" version="5.0"/>

    <service-endpoint name="ExampleNotificationListener"
        path="/ExampleNotificationListener"
        service-instance="tns:ExampleNotificationListenerInstance"
        processing="uddiclient_subscription_listener_v3:UDDIClientProcessing">
        <wsdl uri="uddi_subr_v3.wsdl" 
            service="uddi_subr_v3:UDDI_SubscriptionListener_SoapService"/>
    </service-endpoint>
    <service-instance name="ExampleNotificationListenerInstance"
        implementation-class="com.systinet.subscription.ExampleNotificationListener"
        preload="false" ttl="600" instantiation-method="shared"/>
</package>