Discover and publish Web services with JAXR

The Java API for XML Registries allows registry operations over diverse registry providers

A registry allows organizations to publish and discover Web services. Currently, two registry standards dominate: UDDI (Universal Description, Discovery, and Integration) and ebXML. With either of these, businesses can publish a set of Web services so their internal or external business partners can discover them. However, integrating Web services' discovery and registration regardless of the supported registry standard can prove challenging for businesses. For example, suppose some of the ACME company's multiple business partners published their services in a UDDI registry, while others published in an ebXML registry. How does an ACME Web service application discover those services published by all its business partners? What if ACME wants to publish its services to both UDDI and ebXML registries from within a single Web service application?

JAXR, the Java API for XML Registries, provides a standard API for publication and discovery of Web services through underlying registries. Currently, JAXR is included in the Java Web Services Developer Pack (JWSDP) 1.0 and the recently released Java XML Pack, Summer 02 Release. Additionally, JAXR will play an integral part in J2EE (Java 2 Platform, Enterprise Edition) 1.4. Scheduled for release in early 2003, J2EE 1.4 will be the platform of choice for Web services development and deployment, and compliant vendors will need to provide this API's implementation as an integrated feature in their applications.

In this article, we describe JAXR's architecture and programming models through example code. We explain important registry operations such as publication and discovery of Organizations, Services, usage of ServiceBindings, and ClassificationSchemes. Note: We give special attention to UDDI programmers.

Registry overview

Most business-to-business interactions are collaborations between two parties who engage in a partnership. These business partners share a registry, often in the form of a Web-based service. A registry typically functions as electronic Yellow Pages, where information about businesses and the products and services they offer are published and discovered. A registry can also serve as a database or store shared information, information that can encompass anything. A registry can also work as an electronic bulletin board in which the partners share information in a dynamic and ad hoc fashion. As described in the JAXR specification, information examples include generic event notification, price changes, discounts, and promotions.

What typical operations do registry-service clients perform? Submitting and storing shared information are important registry operations. Clients also need to complete various registry management operations, such as identifying, naming, describing, classifying, associating, grouping, and annotating registry metadata. Finally, clients also must be able to query, discover, and retrieve shared information from the registry and expect that a typical registry support most of these operations.

What is JAXR?

JAXR does not define a new registry standard. Instead, this standard Java API performs registry operations over a diverse set of registries and defines a unified information model for describing registry contents. Regardless of the registry provider accessed, your programs use common APIs and a common information model. The JAXR specification defines a general-purpose API, allowing any JAXR client to access and interoperate with any business registry accessible via a JAXR provider. In this sense, JAXR provides a Write Once, Run Anywhere API for registry operations, simplifying Web services development, integration, and portability.

JAXR's expert group wanted the API to support a union of the best features of UDDI and ebXML, rather than intersect common features. As described in the specification, JAXR is not a least common denominator API.

JAXR architecture

The JAXR architecture defines three important architectural roles:

  • A registry provider implements an existing registry standard, such as the OASIS (Organization for the Advancement of Structured Information)/ebXML Registry Services Specification 2.0.
  • A JAXR provider offers an implementation of the JAXR specification approved by the Java Community Process (JCP) in May 2002. You can implement a JAXR provider as its own JAXR-compliant registry provider. However, you would more likely implement a JAXR provider as a façade around an existing registry provider, such as a UDDI or ebXML registry provider. Currently, the JAXR reference implementation 1.0 offers a JAXR UDDI provider implementation. A group of developers are developing an open source JAXR ebXML provider implementation at www.sourceforge.com.
  • A JAXR client is a Java program that uses JAXR to access the registry provider via a JAXR provider. A JAXR client can be either a standalone J2SE (Java 2 Platform, Standard Edition) application or J2EE components, such as EJBs (Enterprise JavaBeans), Java Servlets, or JSPs (JavaServer Pages). The JAXR reference implementation also supplies one form of a JAXR client, a Swing-based registry browser application.

Figure 1 illustrates how diverse JAXR clients interoperate with diverse registries using JAXR. Architecturally, JAXR clients use the API to perform registry operations, while JAXR providers implement the API. Because JAXR offers a standard API for accessing diverse registry providers and a unified information model to describe registry contents, JAXR clients, whether HTML browsers, J2EE components, or standalone J2SE applications, can uniformly perform registry operations over various registry providers.

Figure 1. JAXR interoperability with any client to any registry. Source: Sun Microsystems

Figure 2 shows a high-level view of the JAXR architecture. The JAXR provider shown is a JAXR pluggable provider with underlying implementations of a UDDI-specific JAXR provider and an ebXML-specific provider. The JAXR provider exposes capability-specific methods to the JAXR client via the RegistryService interface. The JAXR client queries the RegistryService and discovers the provider capability level via the CapabilityProfile interface. We discuss capabilities in the following section.

Figure 2. JAXR architecture. Source: Sun Microsystems

Before a JAXR client can invoke capability-level methods on the JAXR provider, it must connect to the provider. First the client obtains a ConnectionFactory instance using the static method ConnectionFactory.newInstance(). The ConnectionFactory interface lets the client create the Connection using its createConnection() method. Note that the JAXR client connects with the JAXR provider, not the registry provider. The JAXR provider acts as a proxy on the client's behalf, directing and invoking methods on the appropriate registry provider. The connection maintains client state. In addition, the JAXR client dynamically sets its authentication information and communication preference on the connection any time during the connection's lifetime. Please refer to the code demonstrating how a JAXR client connects to a JAXR provider in the development examples later in the article.

After the JAXR client invokes JAXR capability-level methods, the JAXR provider transforms these methods into registry-specific methods and executes requests to the underlying registry providers. After the registry providers process the requests and return registry-specific results to the JAXR provider, the JAXR provider transforms the information into JAXR information model RegistryObjects and returns them to the JAXR client. The RegistryObject interface is an abstract interface that provides the common information such as key, name, and description for the more specialized JAXR information model interfaces. Note that the communication protocol between a JAXR provider and a registry provider is registry provider-specific and transparent to the JAXR client. For example, a JAXR provider communicates with the UDDI registry provider by exchanging basic SOAP messages, while the JAXR provider communicates with the ebXML registry provider through SOAP messaging or ebXML message service.

Capability profiles

Because some diversity exists among registry provider capabilities, the JAXR expert group decided to provide multilayer API abstractions through capability profiles. Each method of a JAXR interface is assigned a capability level, and those JAXR methods with the same capability level define the JAXR provider capability profile.

Currently, JAXR defines only two capability profiles: level 0 profile for basic features and level 1 profile for advanced features. Level 0's basic features support so-called business-focused APIs, while level 1's advanced features support generic APIs. At the minimum, all JAXR providers must implement a level 0 profile. A JAXR client application using only those methods of the level 0 profile can access any JAXR provider in a portable manner. JAXR providers for UDDI must be level 0 compliant.

JAXR providers can optionally support the level 1 profile. The methods assigned to this profile provide more advanced registry capabilities needed by more demanding JAXR clients. Support for the level 1 profile also implies full support for the level 0 profile. JAXR providers for ebXML must be level 1 compliant. A JAXR client can discover the capability level of a JAXR provider by invoking methods on the CapabilityProfile interface. If the client attempts to invoke capability level methods unsupported by the JAXR provider, the provider will throw an UnsupportedCapabilityException.

RegistryService interfaces

As mentioned in the previous section, the JAXR provider supports capability profiles that group the methods on JAXR interfaces by capability level. RegistryService exposes the JAXR provider's key interfaces, that is, Web services discovery and registration. The JAXR client can obtain an instance of the RegistryService interface by invoking the getRegistryService() method on the connection established between the JAXR client and JAXR provider. Once the JAXR client has the RegistryService, it can obtain the primary registry interfaces and perform life-cycle management and query management through the JAXR provider.

The JAXR specification defines two life-cycle management interfaces:

  • BusinessLifeCycleManager for level 0
  • LifeCycleManager for level 1

BusinessLifeCycleManager defines a simple business-level API for life-cycle management. This interface resembles the publisher's API in UDDI, which should prove familiar to the UDDI developer. For its part, LifeCycleManager interface provides complete support for all life-cycle management needs using a generic API.

Life-cycle management includes creating, saving, updating, deprecating, and deleting registry objects. In addition, the LifeCycleManager provides several factory methods to create JAXR information model objects. In general, life-cycle management operations are privileged, while a user can use query management operations for browsing the registry.

JAXR's top-level interface for query management, QueryManager, has two extensions:

  • BusinessQueryManager for level 0
  • DeclarativeQueryManager for level 1

Query management deals with querying the registry for registry data. A simple business-level API, the BusinessQueryManager interface provides the ability to query for the most important high-level interfaces in the information model, such as Organizations, Services, ServiceBindings, ClassificationSchemes, and Concepts. Alternatively, the DeclarativeQueryManager interface provides a more flexible, generic API, enabling the JAXR client to perform ad hoc queries using a declarative query language syntax. Currently, the only declarative syntaxes JAXR supports are SQL-92 and OASIS/ebXML Registry Filter Queries. As noted in the JAXR specification, ebXML registry providers optionally support SQL queries. If a registry provider does support SQL queries, the JAXR ebXML provider will throw an UnsupportedCapabilityException on DeclarativeQueryManager methods.

JAXR information model

Invoking life-cycle and query management methods on the JAXR provider requires the JAXR client to create and use the JAXR information model objects. The JAXR information model resembles the one defined in the ebXML Registry Information Model 2.0, but also accommodates the data types defined in the UDDI Data Structure Specification. Although developers familiar with the UDDI information model might face a slight learning curve, once understood, the JAXR information model will provide a more intuitive and natural interface to most developers.

Most JAXR information-model interfaces are derived from the abstract RegistryObject interface, which defines the common state information, called attributes, that all registry objects share. Example attributes include key, name, and description. The InternationalString interface defines attributes that must be internationalization compatible, such as name and description. The InternationalString interface contains a collection of LocalizedStrings, where each LocalizedString defines locale, character set, and string content.

The RegistryObject interface also defines collections of Classifications, ExternalIdentifiers, ExternalLinks, and Associations. The BusinessQueryManager often uses those collections as parameters in its find methods.

Also specializations of the RegistryObject interface, the concrete interfaces Organization, Service, ServiceBinding, Concept, and ClassificationScheme provide additional state information. For example, the Organization interface defines a collection of Services, and Service defines a collection of ServiceBindings. A ServiceBinding might contain a collection of SpecificationLinks. UDDI developers should be familiar with these concrete interfaces; they map quite well to the five major UDDI data types shown in the table below.

UDDI-to-JAXR information model mappings
JAXR Information ModelUDDI Data Model
Organization BusinessEntity
Service BusinessService
ServiceBinding BindingTemplate
ClassificationScheme TModel
Concept TModel
Association PublisherAssertion

The JAXR specification defines the following information model interfaces:

  • Organization instances are RegistryObjects that provide information on an organization that has been published to the underlying registry.
  • Service instances are RegistryObjects that provide information on services (e.g., Web services) offered by an Organization. An Organization can have a set of Services.
  • ServiceBinding instances are RegistryObjects that represent technical information on how to access a specific interface offered by a Service instance. A Service can have a collection of ServiceBindings.
  • A SpecificationLink links a ServiceBinding with its technical specifications that describe how to use the service. For example, a ServiceBinding might have SpecificationLink instances that describe how to access the service using a technical specification in the form of a WSDL (Web Services Description Language) document or a CORBA IDL (interface definition language) document.
  • A ClassificationScheme instance represents a taxonomy that you can use to classify or categorize RegistryObject instances.
  • Classification instances classify a RegistryObject instance using a classification scheme. Because classification facilitates rapid discovery of RegistryObjects within the registry, the ability to classify RegistryObjects in a registry is one of the registry's most significant features.
  • A Concept instance represents an arbitrary notion, or concept. It can be virtually anything.
  • Association instances define many-to-many associations between objects in the information model.
  • RegistryPackage instances group together logically related RegistryObjects. A RegistryPackage might contain any number of RegistryObjects, and a RegistryObject can be a member of any number of RegistryPackages.
  • ExternalIdentifier instances provide identification information to a RegistryObject. You can base such identification on well-known identification schemes such as DUNS (D&B's Data Universal Numbering System) number and social security number.
  • ExternalLink instances provide a link to content managed outside the registry using a URI (uniform resource identifier).
  • Slot instances dynamically add arbitrary attributes to RegistryObject instances at runtime, an ability that enables extensibility within the information model.
  • Most interfaces in the JAXR information model implement the ExtensibleObject interface. It provides methods that allow the addition, deletion, and lookup of Slot instances.
  • AuditableEvent instances are RegistryObjects that provide an audit trail for RegistryObjects.
  • Affiliated with Organizations, User instances are RegistryObjects that provide information about registered users within the registry. You use User objects in a RegistryObject's audit trail.
  • PostalAddress defines a postal address's attributes. Currently, it provides address information for a User and an Organization.

Develop with JAXR

Now that you've learned the technical details, let's start developing with the API. In the following sections, we present several coding examples that complete the following tasks:

  • Establish a connection between a JAXR client and JAXR provider
  • Registry operation: Find an organization
  • Registry operation: Get organization details
  • Registry operation: Publishing

Establish a connection between a JAXR client and JAXR provider

As mentioned previously, the JAXR client must first connect to the JAXR provider. This connection contains the client state and preference information used when the JAXR provider invokes methods on the registry provider.

Before executing any registry operation, a JAXR client connects with a JAXR provider as shown in the following code. If the JAXR client wishes to submit data to the registry, the client must set authentication information on the connection. Note that the establishment of this authentication information with the registry provider is registry-provider specific and negotiated between the registry provider and the publishing user, often in the form of a Web-based interface. Note: The user does not use the JAXR API to negotiate and establish an account with the registry provider. After establishing a connection, the JAXR client can obtain RegistryService interfaces for Web services discovery and publishing. Those familiar with UDDI will recognize that this example obtains the business-focused APIs, the BusinessLifeCycleManager and the BusinessQueryManager, to perform registry operations shown in later examples:

/** * Establish a connection to a JAXR provider.
 *         Set authentication information, communication preference.
 *         Get business-focused discovery and publish interfaces. 
 */
public void makeConnection() {
   // URLs for RegistryServer included in Java Web Services Developer Pack
   String queryURL ="http://localhost:8080/registry-server/RegistryServerServlet";
   String publishURL ="http://localhost:8080/registry-server/RegistryServerServlet";
  /*
   * Define connection configuration properties.
   * For simple queries, you need the query URL.
   * To use a life-cycle manager, you need the publish URL.
   */
   Properties props = new Properties();
   props.setProperty("javax.xml.registry.queryManagerURL", queryUrl);
   props.setProperty("javax.xml.registry.lifeCycleManagerURL", publishUrl);
   try {
        // Create the connection, passing it the configuration properties
       ConnectionFactory factory = ConnectionFactory.newInstance();
       factory.setProperties(props);
       connection = factory.createConnection();
       System.out.println("Created connection to registry");
       // Get registry service and managers
       RegistryService rs = connection.getRegistryService();
       // Get the capability profile
       CapabilityProfile capabilityProfile = registryService.getCapabilityProfile();
       if (capabilityProfile.getCapabilityLevel() == 0)
 System.out.println("Capability Level 0, Business Focused API");
       // Get manager capabilities from registry service
       BusinessQueryManager bqm = rs.getBusinessQueryManager();
       BusinessLifeCycleManager blcm = rs.getBusinessLifeCycleManager();
       System.out.println("Got registry service, query " + "manager, and lifecycle manager");
      
       // Set client authorization information for privileged registry operations
       PasswordAuthentication passwdAuth = new PasswordAuthentication(username, password.toCharArray());
       Set creds = new HashSet();
       creds.add(passwdAuth);
       // Set credentials on the JAXR provider 
       connection.setCredentials(creds);
       System.out.println("Established security credentials");
      // Set communication preference
      connection.setSynchronous(true);
  } catch (Exception e) {
      e.printStackTrace();
      if (connection != null) {
         try {
              connection.close();
         } catch (JAXRException je) {}
      }
  }
}

Registry operation: Find an organization

Now that the JAXR client has established a connection with the JAXR provider and obtained the BusinessQueryManager and BusinessLifeCycleManager from the RegistryService interface, the client can now invoke methods on these interfaces. Often, a JAXR client will wish to discover the services an organization offers. To do so, the JAXR client would invoke methods on the BusinessQueryManager. An example use case might be the following:

A user browsing the UDDI registry wishes to find an organization that provides services of the NAICS (North American Industry Classification System) type Computer Systems Design and Related Services in the United States. To perform this query with JAXR, the user would invoke a findOrganization() method with classification listed under the well-known taxonomies NAICS and ISO 3166 Geographic Code System (ISO 3166). As JAXR provides a taxonomy service for these classifications, the client can easily access the classification information needed to be passed as findOrganization() parameters. A sample of this query to the taxonomy service and registry follows below:

public void findOrganizations()
throws JAXRException {
    // Search criteria -- Organizations found will return in this sort order
    Collection findQualifiers = new ArrayList();
    findQualifiers.add(FindQualifier.SORT_BY_NAME_DESC); 
 
    // Query the JAXR taxonomy service
    ClassificationScheme naics =      businessQueryManager.findClassificationSchemeByName(findQualifiers, "ntis-gov:naics:1997"); 
 
    // Create the classification that will be a parameter to findOrganization() method
    Classification computerSystemsDesign = businessLifeCycleManager.createClassification
(naics, "Computer Systems Design and Related Services", "5415");
    // Query the taxonomy service
    ClassificationScheme geography = businessQueryManager.findClassificationSchemeByName
(findQualifiers,"iso-ch:3166:1999"); 
 
    // Create the classification passed as a parameter to findOrganization() method.
    Classification us = businessLifeCycleManager.createClassification(geography, 
"United States", "US"); 
 
    // Add classifications to the classifications collection parameter
    Collection classifications = new ArrayList();
    classifications.add(computerSystemsDesign);
    classifications.add(us); 
 
 
    // Invoke the findOrganizations() method on BusinessQueryManager
    BulkResponse bulkResponse = businessQueryManager.findOrganizations(findQualifiers, null, classifications, null, null, null);
    if (bulkResponse.getStatus() == JAXRResponse.STATUS_SUCCESS) {
             System.out.println("Found Organization located in the United States 
categorized Computer Systems Design and Related Service");
             
    }
}

Most calls invoked on the registry provider via the JAXR provider return a BulkResponse that contains any registry exceptions encountered and a collection of concrete RegistryObjects or RegistryObject keys. To ensure that a registry invocation always returns a response, any exceptions generated by the registry provider are wrapped in a RegistryException and stored in the BulkResponse's exceptions collection. In the case of find methods, any RegistryObjects found are contained in the BulkResponse collection.

Registry operation: Get organization details

For the above findOrganization() method, the BulkResponse contains a collection of Organizations found in the registry provider that match the classifications passed as parameters to the method. However, these Organizations provide limited information about the Organization and its Services such as key, name, and description. Another value-added feature of JAXR is the incremental loading of RegistryObject details. For instance, in the case of a JAXR UDDI provider, a JAXR findOrganization() method transforms to a UDDI find_Business request. After invocation, the find_Business request returns minimal business and service information such as ID, name, and description. Using UDDI APIs, a UDDI client would need to make an additional call such as get_BusinessDetail() to retrieve the organization details. With JAXR, the JAXR UDDI provider performs this invocation to the registry provider on an as-needed basis. The JAXR client can access Organization and other RegistryObject details by using the get methods on the JAXR information model interfaces. The getOrganizationDetail() method demonstrates how a JAXR client would obtain full Organization details:

public void getOrganizationDetail(BulkResponse bulkResponse) 
throws JAXRException { 
 
    // Get a collection of Organizations from BulkResponse
    Collection organizations = bulkResponse.getCollection();
    // Iterate through the collection to get an individual Organization
    Iterator orgIter = organizations.iterator();
    while (orgIter.hasNext()) {
         Organization organization = (Organization)orgIter.next();
         // Get a collection of Services from an Organization
         Collection services = organization.getServices();
         // Iterate through the collection to get an individual Service
         Iterator serviceIter = services.iterator();
         while (serviceIter.hasNext()) {
              Service service = (Service)serviceIter.next();
 
              // Get a collection of ServiceBindings from a Service
              Collection serviceBindings = service.getServiceBindings();
              // Iterate through the collection to get an individual ServiceBinding
              Iterator sbIter = serviceBindings.iterator();
              while (sbIter.hasNext()) {
                   ServiceBinding serviceBinding = (ServiceBinding)sbIter.next(); 
                   // Get URI of the service.  You can access the service through this URI.
                   String accessURI = serviceBinding.getAccessURI();
                   System.out.println("Access the service "  + 
service.getName().getValue() + " at this URI " + accessURI);
  
                   // Get a collection of SpecificationLinks from a ServiceBinding. 
                   // SpecificationLinks provide further technical details needed to access the 
service. 
                   Collection specificationLinks = serviceBinding.getSpecificationLinks();
                   // Iterate through the collection to get an individual SpecificationLink
                   Iterator linkIter = specificationLinks.iterator();
                   while (linkIter.hasNext()) {
                         SpecificationLink specificationLink = (SpecificationLink)linkIter.next(); 
 
                        // Get a collection of ExternalLinks from SpecificationLink 
                        // An ExternalLink points to technical detail necessary to invoke the service
                        Collection externalLinks = specificationLink.getExternalLinks();
                        // Iterate through the collection to get an ExternalLink
                        Iterator elinkIter = externalLinks.iterator();
                        while (elinkIter.hasNext()) {
                             ExternalLink externalLink = (ExternalLink)elinkIter.next();
                             // The externalURI is the pointer to the technical details 
                             // necessary to invoke the service
                             String externalURI = externalLink.getExternalURI();
                             System.out.println(" Use the technical detail at this URI, 
" + externalURI + " to invoke the service, " + service.getName().getValue());
                         } 
 
                         // Obtain usage description
                         InternationalString usageDescription = specificationLink.getUsageDescription();
                         // Any parameters necessary to invoke service are in usageParameter collection
                         Collection usageParameters = specificationLink.
getUsageParameters();
                         // Get the specification concept from the specification link
                         // This specificationConcept is equivalent to the tModel registered as the technical specification
                         Concept specificationConcept = (Concept) specificationLink.getSpecificationObject();
                   }
             }
       }
   }

Registry operation: Publishing

The JAXR client also publishes Web services, another important registry operation. In addition to discovering partner organization information and services, an organization will want to register its information and services in the registry for partner use. If a JAXR client wishes to publish an organization and its services to a registry, the client uses the LifeCycleManager or the more focused BusinessLifeCycleManager. Clients familiar with UDDI should use the BusinessLifeCycleManager, which provides methods for saving information to the registry provider. Since this is a privileged operation, the user must set authentication information on the JAXR connection. Note that the JAXR provider, not the JAXR client, performs authentication with the registry provider. The JAXR provider negotiates this authentication with the registry provider on an as-needed basis, and the authentication is completely transparent to the JAXR client.

Suppose the organization Fly Away Airline Travel Agents has a Web-based airline reservation service that its partner travel agencies must be able to use. The following code creates such a business and saves it to the registry. The business has contact information, a set of services it offers, and technical information for accessing those services:

public void saveOrganization() 
throws JAXRException {
            
    // Create Organization in memory
    Organization org = businessLifeCycleManager.createOrganization
("Fly Away Airline Travel Agents");
   
   // Create User -- maps to Contact for UDDI
   User user = businessLifeCycleManager.createUser();
   PersonName personName = businessLifeCycleManager.createPersonName("Marie A Traveler");
   
   
   TelephoneNumber telephoneNumber = businessLifeCycleManager.createTelephoneNumber();
   telephoneNumber.setNumber("781-333-3333");
   telephoneNumber.setType("office");
   Collection numbers = new ArrayList();
   numbers.add(telephoneNumber);
   
  
   EmailAddress email = 
       businessLifeCycleManager.createEmailAddress("marieb@airlinetravel.com", 
"office");
   Collection emailAddresses = new ArrayList();
   emailAddresses.add(email);
   
  
   user.setPersonName(personName);
   Collection telephoneNumbers = new ArrayList();
   telephoneNumbers.add(telephoneNumber);
   user.setTelephoneNumbers(telephoneNumbers);
   user.setEmailAddresses(emailAddresses);
   org.setPrimaryContact(user);
   
  
   // Create service with service name and description
   Service service =  businessLifeCycleManager.createService("Fly Away Airline Reservation Service");
   service.setDescription(businessLifeCycleManager.createInternationalString("Flight Reservation Service"));
   
   // Create serviceBinding
   ServiceBinding serviceBinding = businessLifeCycleManager.createServiceBinding();
   serviceBinding.setDescription(businessLifeCycleManager.createInternationalString
("Information for airline reservation service access"));
   //Turn validation of URI off
   serviceBinding.setValidateURI(false);
   serviceBinding.setAccessURI("http://www.airlinetravel.com:8080/
services.reservations.html");
  
  
   // Create the SpecificationLink information
   SpecificationLink specificationLink = businessLifeCycleManager.createSpecificationLink();
  
   // Set usage description
   specificationLink.setUsageDescription(businessLifeCycleManager.
createInternationalString("Search for Reservations when prompted"));
   String usageParameter = "Enter travel agent id when prompted"; 
   Collection usageParameters = new ArrayList();
   usageParameters.add(usageParameter);
  
   // Set usage parameters
   specificationLink.setUsageParameters(usageParameters);
  
   // Set specificationConcept on the specificationLink
   Concept httpSpecificationConcept = (Concept) businessLifeCycleManager.createObject(businessLifeCycleManager.CONCEPT);
   Key httpSpecificationKey = businessLifeCycleManager.createKey("uuid:68de9e80-ad09-469d-8a37-088422bfbc36");
httpSpecificationConcept.setKey(httpSpecificationKey);
specificationLink.setSpecificationObject(httpSpecificationConcept);
  
   // Add the specificationLink to the serviceBinding
   serviceBinding.addSpecificationLink(specificationLink);
   
   // Add the serviceBinding to the service
   service.addServiceBinding(serviceBinding);
  
   // Add the service to the organization
   org.addService(service);
   
  
   // Add classifications to the organization
   ClassificationScheme naics = businessQueryManager.findClassificationSchemeByName(null, "ntis-gov:naics");
   Classification classification = businessLifeCycleManager.createClassification
(naics, "Air Transportation", "481");
   org.addClassification(classification);
   Collection orgs = new ArrayList();
   orgs.add(org);
   
   BulkResponse br = businessLifeCycleManager.saveOrganizations(orgs);
   if (br.getStatus() == JAXRResponse.STATUS_SUCCESS) {
       System.out.println("Successfully saved the " + " organization 
to the registry provider .");
   }
}

JAXR implementations

We know you will want to get started developing Web service applications using JAXR, perhaps using the programming examples shown above. How do you get JAXR implementations? A typical JAXR implementation comes with three software modules: a registry provider designed for a particular registry specification, like UDDI or ebXML; a JAXR provider for a particular registry provider; and a registry browser.

Currently two JAXR provider implementations are available for use with current UDDI and ebXML registry providers. The JWSDP 1.0 includes the JAXR 1.0 reference implementation that consists of a UDDI Version 2.0 JAXR provider, a UDDI 2.0 RegistryServer, and registry browser. As mentioned previously, the open source community is currently developing an ebXML 2.0 JAXR provider and an ebXML 2.0 registry. Figure 3 shows the registry browser that comes with the JAXR reference implementation; you can use the browser to add organizations and their categorized services to a UDDI registry provider.

Figure 3. Registry browser

Get started developing Web services

JAXR provides a standard Java API and unified information model for performing registry operations over diverse registry providers, especially over the UDDI and ebXML registry providers. Typical registry operations include publication and discovery of Web services. To accommodate various functionalities from different registry providers, JAXR offers a layered architecture, where capabilities are grouped as a capability profile. A level 0 capability profile provides a simple, yet focused and high-level business API, while a level 1 capability profile provides a flexible, low-level, and generic API. You should familiarize yourself with JAXR, as it will become an important part of J2EE 1.4, the Java-based platform for Web services development and deployment.

Sang Shin is a Java technology evangelist for Sun Microsystems. He frequently talks about important Java technologies such as Jini, J2EE, EJB, JMS (Java Message Service), J2ME (Java 2 Platform, Micro Edition), Java and XML, and Web services technologies. He also teaches several software engineering courses at Brandeis University in Waltham, Mass. Kathy Walsh is a member of the technical staff in the XML Web services group and the implementation lead for JAXR at Sun. In her previous life, she was involved in EAI (enterprise application integration) and OSS (operation support system) development, network management, and network application programming development.

Learn more about this topic

Join the discussion
Be the first to comment on this article. Our Commenting Policies
See more