Web ServicesUDDI V3 Subscriptions, Part II

UDDI V3 Subscriptions, Part II

Developer.com content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

Introduction

Universal Description, Discovery, and Integration (UDDI) technology is becoming the lingua franca for Web services publishing and discovery mechanisms. UDDI V2 specifications have been promoted as OASIS standards. UDDI V3 specifications are UDDI Spec TC Committee specifications under OASIS.

In the second part of this series of articles, I will discuss the Java APIs used to demonstrate the subscription services in WASP UDDI. I assume readers are aware with the UDDI technology and XML schemas.

WASP UDDI

WASP UDDI is the most comprehensive, feature-rich private registry available today for businesses to collaborate between trusted parties using standards protocols. WASP UDDI provides the complete implementation of UDDI Version 2 Specification. In addition to this, it also implements the Subscription service that is part of the UDDI V3 Specification. Its robust implementation and its support across various platforms is the key to its successful adoption as a preferred Web services registry among its customers.

WASP UDDI Subscription APIs

WASP UDDI provides a set of Java APIs for using the subscription mechanism with in its UDDI registry. The interfaces and classes are defined in the package “org.systinet.myuddi.subscription”. This package provides classes for subscription management, which includes Subscription API set.

Saving a subscription

Listing 1 shows the usage of WASP UDDI subscription APIs to create a subscription in the UDDI Registry.

String subscriptionKey = null;

// Create a holder for all parameters of save_subscription API
// call.
SaveSubscription saveSubscription = new SaveSubscription();

// Create a holder structure to accomodate information related to
// the subscription.
Subscription subscription = new Subscription();

// Create a Subscription that will expire after one year
long currentTime = System.currentTimeMillis();
long year = 365*24*60*60*1000;
subscription.setExpiresAfter(new Date( currentTime + year ));

// Set notification should contain only 10 records
subscription.setMaxEntities(new MaxEntities(10));

subscription.setBrief(new Brief(true));

// Set the notification interval of the subscription to 1 day.
// This is used in asynchronous subscriptions.
//subscription.setNotificationInterval(new Duration("P1D"));

// Attach the binding key to the subscription, so that
// notifications are sent to services that are specified in the
// accessPoint.
// subscription.setBindingKey(new BindingKey(
                "3409e140-bb66-11d7-ae30-b8a03c50a862"));

// Create subscription filter structure for a subset of
// registry data.
SubscriptionFilter subscriptionFilter = new SubscriptionFilter();

// Create and fill find business structure
FindBusiness findBusiness = new FindBusiness();
findBusiness.addName(new Name("WASP UDDI Subscription"));

// subscriptionFilter holds findBusiness ...
subscriptionFilter.setFindBusiness(findBusiness);

// Set the find_business query as subscriptionFilter to the
// subscription
subscription.setSubscriptionFilter(subscriptionFilter);

Subscriptions subscriptions = new Subscriptions();
subscriptions.add(subscription);

saveSubscription.setSubscriptions(subscriptions);
saveSubscription.setAuthInfo(authToken.getAuthInfo());
Subscriptions response =
     subscriptionService.save_subscription(saveSubscription);
subscriptionKey = response.first().getSubscriptionKey().getValue();
System.out.println("Created Subscription with key : " +
                   subscriptionKey);

Listing 1: Usage of the WASP UDDI’s save_subscription call.

Getting subscriptions

Listing 2 shows the usage of WASP UDDI subscription APIs to get the subscriptions registered in the UDD Registry.

Subscriptions subscriptions = null;
String subscriptionKey = null;
// Fill in the request parameter - authInfo
GetSubscriptions getSubscriptions = new GetSubscriptions();
getSubscriptions.setAuthInfo(authToken.getAuthInfo());

// Process get_subscriptions request
subscriptions =
    subscriptionService.get_subscriptions(getSubscriptions);
if (subscriptions != null) {
  subscriptionKey =
    subscriptions.first().getSubscriptionKey().getValue();
} else {
  System.out.println("No subscriptions found.");
}

Listing 2: Usage of the WASP UDDI’s get_subscriptions call.

Getting subscription results

Listing 3 shows the usage of WASP UDDI subscription APIs to get the subscription results based on the changes that occurred over a period of time in the UDDI Registry.

// Fill in the request parameters
GetSubscriptionResults getSubscriptionResults =
    new GetSubscriptionResults();

// Set key of existing subscription
getSubscriptionResults.setSubscriptionKey(new SubscriptionKey(
                                          getSubscriptions()));

// Changes in last 2 minutes
long endPoint = System.currentTimeMillis();
long startPoint = endPoint - 2*60*1000;
getSubscriptionResults.setCoveragePeriod(new CoveragePeriod(
                                         new Date(startPoint),
                                         new Date(endPoint)));

// Set user identity
getSubscriptionResults.setAuthInfo(authToken.getAuthInfo());

// Process get_subscriptionResults request
SubscriptionResultsList list =
    subscriptionService.get_subscriptionResults(
        getSubscriptionResults);

Listing 3: Usage of the WASP UDDI’s get_subscriptionResults call.

Deleting a subscription

Listing 4 shows the usage of WASP UDDI subscription APIs to delete a subscription in the UDDI Registry.

// Create list of subscriptionKeys with only one subscriptionKey -
// the given parameter
SubscriptionKeys keys = new SubscriptionKeys();
keys.add(new SubscriptionKey(subscriptionKey));

// Fill in the request parameters: subscriptionKey, authToken
DeleteSubscription deleteSubscription =
    new DeleteSubscription(authToken.getAuthInfo(), keys);

// Process delete_subscription request
DispositionReport dispositionReport =
    subscriptionService.delete_subscription(deleteSubscription);

Listing 4: Usage of the WASP UDDI’s delete_subscription call.

Setting Up WASP UDDI 4.6

WASP UDDI Version 4.6 is the latest in its product line. You can download a 90-day evaluation version of the product from Systinet’s Web site. As a pre-requisite for installation, you need to have J2SE 1.4.x. You can install WASP UDDI 4.6 as a standalone registry or you can deploy it in your preferred applications server. WASP UDDI 4.6 supports leading application servers including BEA WebLogic, IBM WebSphere, Oracle, Orion, Tomcat, Jboss, and Sun ONE Application Server. Its support for leading database engines including Oracle, MS SQL 2000, DB2, PostgreSQL, Sybase, Cloudscape, PointBase, and Hypersonic SQL. In addition to this, WASP 4.6 can be run as a standalone server with an embedded Hypersonic SQL engine.

Start the WASP UDDI server by executing %WASP_HOME%/bin/serverstart.bat.

Once the server is started, open a browser pointing to the URL: http://localhost:8080/uddi/web. You should be seeing the Systinet’s WASP UDDI Console. The publishing, inquiry, and subscription URLs are shown below.

PUBLISHING_URL  =https://localhost:8443/uddi/publishing
INQUIRY_URL     =http://localhost:8080/uddi/inquiry
SUBSCRIPTION_URL=http://localhost:8080/uddi/subscription

This article uses Systinet’s WASP UDDI 4.6 as a standalone server with an embedded HSQL database engine installed in a Windows 2000 environment.

Conclusion

With the help of subscriptions, a subset of the registry data can be monitored for a specific business need. Subscriptions help businesses to participate in a collaborative environment where they address the needs of a specific industry. More registries should soon become available with this powerful feature in place. The vision of UDDI is coming to reality with its powerful features, such as subscriptions, changing the way businesses collaborate.

References

UDDI Version 3.0
UDDI Spec Technical Committee Specification, 19 July 2002
http://uddi.org/pubs/uddi-v3.00-published-20020719.htm

Subscriptions—A UDDI V3 Mantra
http://dev.systinet.com/download/subscription.pdf

UDDI V3 Subscriptions, Part I
http://www.developer.com/services/article.php/3088901

Systinet WASP UDDI 4.6 Product Overview
http://www.systinet.com/products/wasp_uddi/overview

Systinet WASP UDDI 4.6 Product Documentation
http://www.systinet.com/doc/wasp_uddi/uddi/index.html

Systinet WASP UDDI 4.6 Evaluation Version—Download
http://www.systinet.com/products/wasp_uddi/download/list

About the Author

Arulazi Dhesiaseelan has been working as a Senior Software Engineer for Hewlett-Packard. He has a Master of Computer Applications Degree from the PSG College of Technology, India. He has more than three years of industry experience. He was also involved in the UDDI4J project hosted at http://uddi4j.org. He has been working on Web Service-related technologies such as WSDL, UDDI, and SOAP. Currently, he is involved in developing an object-based infrastructure for mobile solutions. He can be reached at aruld@acm.org.

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories