| By Andrew J. Bradfield | Article Rating: |
|
| October 1, 2004 12:00 AM EDT | Reads: |
20,168 |
UDDI (Universal Description, Discovery, and Integration) is fast becoming a standard for storing business processes available on the Web. Although UDDI is capable of storing many different types of data, for the purposes of this article I'll focus on how UDDI can be used to register Web services, thereby making them available for application-level consumption.
What Is Covered?
This article provides Java developers with a fast and simple way to develop their own UDDI Java applications to consume Web services registered within a UDDI Registry. The sample code (the source code is online at www.sys-con.com/webservices/sourcec.cfm) contains a payroll Web service (deployed from an entity bean) and a UDDI session bean.
Background
This article is based heavily on the tutorial Discover Web services with the WSDK V5.1: UDDI cited in the Resources section. I will present an extension to the basic UDDI4J classes so you can quickly set up your own UDDI registry of Web services. While working through the Discover Web services with the WSDK V5.1: UDDI tutorial, I developed an extension API that provides a higher-level approach to the UDDI4J API. This article extends only a small subset of that functionality, since its purpose is to register, discover, and consume a Web service stored within a UDDI Registry. For a broader discussion of UDDI and its uses beyond storing Web services, please see Understanding UDDI by Tom Bellwood.
Payroll Web Service
The Payroll.ear file contains an EJB project named PayrollEjbPrj. Within this EJB project are two entity beans, Department and Employee, and one session bean, Payroll. The Department and Employee entity beans expose getter and setter methods for the sample database. The Payroll bean, which exposes 12 methods, uses the getter methods of the entity beans to query various pieces of information from the sample database. The sample code can easily be extended to provide setter functionality from within the Payroll bean. Exposing all of the sample database fields is beyond the scope of this article.
UDDIClient Session EJB
The UDDIClient session bean makes almost exclusive use of the UDDI utility API discussed in the next section.
A UDDI Registry may contain Businesses, Services, and TModels. The UDDIClient bean provides a publish() and two delete() methods for each type of UDDI entry. As shown in the method signatures in Listing 1, these methods are as simple as possible, while shifting the work to the UDDI Utility API.
Methods getService and executeService
The getService and executeService methods of the provided UDDIClient bean demonstrate how to retrieve our Payroll Web service and invoke some of its methods. The executeService method takes a string representing the name of a service stored in the registry. In the sample code, the service registered is the Payroll Web service. For this article, I've hard coded two methods that are called from the Payroll Web service found within the registry (see Listing 2).
UDDI Utility API
The UDDI Utility API has four main classes, three of which are shown in Listings 3?5. The fourth, Utilities.class, contains all of the setup information for the UDDI Registry. The values and structure are explained in detail in the Publishing your services on UDDI with the WSDK V5.1 tutorial (see Listing 3).
Configuration Assumptions
You are using IBM WebSphere Studio Application Developer 5.0 or another J2EE- compliant development environment such as the Eclipse IDE.
A DB2 application has been installed and a sample database has been created. (This sample uses the Employee and Department tables. To create the sample database, Open DB2 First Steps and click on the "Create Sample Database" link).
A UDDI Registry is installed and properly configured. Please see the InstallUDDI listing for an automated setup of a UDDI Registry to use the Cloudscape Database. Execute installuddilibs.bat from a command window to create the necessary directory structure.
Summary
As you have seen, UDDI programming can be a very powerful way to share information on the Web via the UDDI Registry. This sample code, and more specifically the UDDI Utility API, are provided as a starting point from which you can develop a more customized solution.
Resources
Code
Specifications
Tools
Other Resources
Published October 1, 2004 Reads 20,168
Copyright © 2004 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Andrew J. Bradfield
Andrew J. Bradfield is an advisory software engineer at IBM's Software Division located at the IBM T.J. Watson Research Center in Hawthorne, NY. His projects include J2EE development of content management and data management solutions. Andrew graduated with a degree in computer science from Hamilton College in Clinton, NY.
- Big Data in Telecom: The Need for Analytics
- Patterns for Building High Performance Applications
- Microsoft Tries Hadoop on Azure
- Amazon to Fix Some Kindle Fire Problems
- What Motivates Open Standards in the Cloud?
- What to Expect in 2012: Cloud Computing and Open Source Software
- Will PaaS Finally Bring Open Source Love to the Enterprise?
- Ten Hot Trends in Cloud Data for 2012
- Oracle Disaster Recovery Site Hosted by Amazon Cloud
- Cross-Platform Mobile Website Development – a Tool Comparison
- Three Buzzwords That Every CIO Hears but One They Should Listen To
- Write Once Run Anywhere or Cross Platform Mobile Development Tools
- The Future of Cloud Computing: Industry Predictions for 2012
- Make Customer On-Boarding Easy as Paint-by-Numbers for Cloud Services
- Gartner Hype Cycle for Emerging Technologies 2011
- Book Excerpt: Introducing HTML5
- Adobe Sends Flex to the Apache Foundation
- Big Data in Telecom: The Need for Analytics
- Book Excerpt: Java Application Profiling Tips and Tricks
- i-Technology in 2012: Five Industry Predictions
- Patterns for Building High Performance Applications
- Microsoft Tries Hadoop on Azure
- The Next Web Architecture
- Cloud Computing: A Comparison of Computing Models
- The i-Technology Right Stuff
- The Top 150 Players in Cloud Computing
- Who Are The All-Time Heroes of i-Technology?
- Where Are RIA Technologies Headed in 2008?
- Get the Message
- ESB Myth Busters: 10 Enterprise Service Bus Myths Debunked
- i-Technology Viewpoint: Is Web 2.0 the Global SOA?
- i-Technology Viewpoint: Thinking Outside the VC Box
- i-Technology Viewpoint: When to Leave Your First IT Job
- SOA Web Services Edge Conference Coverage on SYS-CON.TV
- SYS-CON.TV's "SOA Web Services" and "Enterprise Open Source" Programs To Air in December
- Five Reasons Why Web 2.0 Matters

















