Java Reference
In-Depth Information
Querying a UDDI Registry Programmatically
Problem
You want a way to query your UDDI-compliant registry in Java code.
Solution
Add the <glassfish-home>/lib/javaee.jarto your classpath, and use the JAX-R API to publish
and query your registry.
Discussion
If you have set up a UDDI registry, you may want a way to query it from within Java code.
The API for doing this is called JAX-R, or Java API for XML Registries. You can check out
the JavaDoc for JAX-R online at http://java.sun.com/j2ee/1.4/docs/api/ .
NOTE
The UDDI spec is enormous and very complicated, and would require a whole book to cover it. Here
you're just going to get a feel for using the registry, and I'll point to some useful tools for you to
explore on your own. You can read the spec at http://www.uddi.org/pubs/uddi_v3.htm .
Overview
There are two basic interactions with a JAX-R registry: publish and inquiry. Publish adds in-
formation about organizations and services, while inquiry runs query statements against it that
allow you to find information.
There are a few steps to get set up. First, put the javaee.jaron your classpath. That gives you
the JAX-R API. You also need an implementation of things like the Connection Factory.
Testing the client
Example 11-1 shows a Java client that accesses your jUDDI registry and queries it for a little
information.
Example11-1.Querying a jUDDI registry with JAX-R
package com.soacookbook.scout;
import java.util.ArrayList;
Search WWH ::




Custom Search