Testing the Sample Application
The sample application
uses a simple driver class called "Test" to illustrate how to obtain an authentication token and how to search for particular businesses:
Sample Application Test Results
public class Test
public static void main(String args)
Test app = new Test();
GetAuthToken getAuthToken = new GetAuthToken();
AuthToken token = getAuthToken.getToken();
if (token == null)
"Unable to obtain authToken");
FindBusinesses findBusinesses = new
Enumeration enum = findBusinesses.find();
org.apache.juddi.datatype.Name businessName =
System.out.println("Found business: " +
To run the sample application
, you will need to:
|Figure 1. jUDDI "Happiness" Page: The figure shows the result of running the link The figure shows the result of running the link http://<hostname>:<port>/juddi/happyjuddi.jsp, which displays jUDDI information.
- Start the UDDI registry Web application. Refer to the previous article in this series to learn how to start the Web application.
- Populate the business_entity database with one record having a publisher_id of "Sun."
- Populate the business_name database with one record having a name of "Sun."
With the Web application started, the link http://<hostname>:<port>/juddi/happyjuddi.jsp
will reveal a jUDDI happiness page similar to the page in Figure 1
After starting the UDDI registry Web application and populating it with a business named "Sun," you can run the test application. The resulting output should look like Figure 2
Identifying and Calling Alternate Services
|Figure 2. Sample Application Output: Here's what the sample application's output should look like after starting the UDDI registry Web application and populating it with a single business, named "Sun."|
UDDI allows for multiple bindings or URLs to be associated with the actual physical endpoints to Web services, thus allowing you to provide a failover mechanism in the event that your primary service choice is not available. These endpoints are designated in the tModel
data structure of a registry entry.
To review, tModel
entries represent technical information about a service or services. This information is embodied within interface specifications such as WSDL documents, XSD files, XML files, etc.
You can also use a businessEntity
structure for service failover, because that structure represents all known information about a business and the services that it offers. The following example illustrates a typical businessEntity
<element ref="uddi:discoveryURLs" minOccurs="0" />
<element ref="uddi:name" maxOccurs="unbounded" />
<element ref="uddi:description" minOccurs="0"
<element ref="uddi:contacts" minOccurs="0" />
<element ref="uddi:identifierBag" minOccurs="0" />
<element ref="uddi:categoryBag" minOccurs="0" />
type="uddi:businessKey" use="required" />
<attribute name="operator" type="string"
<attribute name="authorizedName" type="string"
element of a businessEntity
structure is optional. However, this element contains a list of Uniform Resource Locators (URLs) that can point to alternate document-based service discovery mechanisms.
structure holds pointers (a list of discoveryURL
elements) to URL-addressable discovery documents that you can retrieve via an HTTP/GET method call. Each discoveryURL
element holds a 255-character-length string that represents a Web-addressable discovery document.
UDDI automatically assigns each recorded businessEntity
structure a URL that returns the individual businessEntity
structure. You conduct a URL search via the find_business
For example, here's a discoveryURL
list for a particular businessEntity
Finally, because a UDDI registry acts as an abstract layer between Web service clients and each particular Web service, the registry itself inherently provides a framework for failover and redundancy.
Refer to this DevX Special Report article, "Winning with Web Services
" for a detailed look at tModels
, discoveryURLs, and the find_business
The Universal Description, Discovery, and Integration (UDDI) specification and protocol work together to form one of the primary components of a complete Web services infrastructure. By following the steps shown in the article, you can use your private UDDI registry to find businesses, services, and alternate services.