Sun Java System logo     
JAXR Sample Application



JAXR Sample Application


This document describes how to utilize the JAXR sample application in conjunction with Sun Java (tm) System Application Server 7.

This sample application document contains the following sections:



Overview

The purpose of this document is to demonstrate the support for the Java API for XML Registries in the Sun Java (tm) System Application server. This document describes how to compile, assemble and run various components of the JAXR application.

An XML registry is an infrastructure that enables the building, deployment, and discovery of Web services. The Java API for XML Registries (JAXR) provides a uniform and standard Java API for accessing different kinds of XML Registries.

The high-level architecture of JAXR consists of the following parts:

A JAXR client that uses the JAXR API to access a registry via a JAXR provider.

A JAXR provider that implements the RegistryService interface and other interfaces to allow a client to access registries. The provider provides registry access and registry object interfaces.

The purpose of this application is to address the JAXR client. For more information on JAXR, go to: java.sun.com/xml/jaxr/index.html.

The application has nine main Java classes that communicate with the JAXR provider. Each class has a makeConnection method to get the connection to the registry. There is a wrapper client class that reads input from the user or from asant, and calls one of the JAXR client classes accordingly. The source code is located at: <install_dir>/samples/webservices/jaxr/src/samples/webservices/jaxr/service/

and <install_dir>/samples/webservices/jaxr/src/samples/webservices/jaxr/client/.


Table 1    Main Java Classes

Class Name

Description

JAXRQuery

 

This class implements the makeConnection API, the executeQuery API, and some private utility methods. The excuteQuery API queries the registry for the user input string.  

JAXRPublish

 

This class implements the makeConnection API and the executePublish API. The executePublish API, authenticates the user and publishes an organization to the registry.  

JAXRDelete

 

This class implements the makeConnection API, the executeRemove API, and some private utility methods. The executeRemove API, authenticates the user and deletes an organization with a key provided by the user.  

JAXRQueryByWSDLClassification

 

This class implements the makeConnection API, the executeQuery API, and some private utility methods. The executeQuery API queries the registry for organizations that offer services based on technical specifications that take the form of WSDL documents.  

JAXRQueryByNAICSClassification

 

This class implements the makeConnection API, the executeQuery API, and some private utility methods. The executeQuery API queries the registry for organizations that use an NAICS classification.  

JAXRSaveClassificationScheme

 

This class implements the makeConnection API and the executePublish API. The executePublish API, authenticates the user and publishes a classification scheme to the registry.  

JAXRDeleteScheme

 

This class implements the makeConnection API, the executeRemove API, and some private utility methods. The executeRemove API, authenticates the user and deletes a classification scheme with a key provided by the user.  

JAXRGetMyObjects

 

This class implements the makeConnection API, the executeQuery API, and some private utility methods. The executeQuery API, authenticates the user and retrieves all the objects in the registry server, owned by the user.  

JAXRPublishPostal

 

This class implements the makeConnection API and the executePublish API. The executePublish API authenticates the user and publishes an organization, with contact person having postal address in user-specified uuid format, to the registry.  

JAXRQueryPostal

 

This class implements the makeConnection API, the executeQuery API, and some private utility methods. The excuteQuery API queries the registry for the user input string and displays the postal addresses using user-specified uuid scheme.  

JAXRDelete

 

This class implements the makeConnection API, the executeRemove API, and some private utility methods. The executeRemove API, authenticates the user and deletes an organization with a key provided by the user.  

JAXRClient

 

This is the wrapper class that calls the above classes, depending upon user input.  



Compiling and Assembling the Application



This section contains instructions to build and assemble the JAXR sample application using the Command Line Interface. See the Sample Application Build Facility document for details on using a build facility.

To rebuild the entire application from scratch, follow these steps:

  1. Compile and assemble the application. For example:

    Execute the asant command under <install_dir>/samples/webservices/jaxr/src/

    The default target core is executed to compile Java files and rebuild the .jar file. The .jar file has the JAXR API classes and a wrapper client class.

  2. Build Javadocs. For example:

    Execute asant javadocs command under <install_dir>/samples/webservices/jaxr/src/ to create javadocs.

    The Javadocs are created under <install_dir>/samples/webservices/jaxr/javadocs.

  3. Clean the web application project area. For example:

    Execute the asant clean command under <install_dir>/samples/webservices/jaxr/src/ to clean the application build and assemble area.

  4. Deploy the sample application.

After you have re-created the sample application from scratch, proceed to Deploying the Sample Application.



Deploying the Sample Application



The Java API for XML Registries can be configured to access various registries. You can use either your own registry server or you can use public registry servers. If you choose to use a public registry server, make certain that you can publish to the registry server.

Please modify <install_dir>/samples/webservices/jaxr/src/jaxr.properties with the correct parameters.


Table 2   

query-url

 

Fully qualified inquiry URI for the registry server.

 

publish-url

 

Fully qualified publish URI for the registry server.

 

username

 

Username to publish an organization to the registry server.

 

password

 

Password to publish an organization to the registry server.

 

query-string

 

The search string to search for in the registry.

 

key-string

 

The key of the organization to be deleted from the registry server.

 

If you wish to publish to the registry server, modify the publish organization info section under <install_dir>/samples/webservices/jaxr/src/jaxr.properties, if required.

You may now proceed to Running the Sample Application.



Running the Sample Application



The sample application provides capabilities of querying, publishing to, and deleting from various registries. A pre-built .jar file is provided for running the application without compiling. Separate targets are provided to perform these activities.

Before running the application, make certain that you have followed the Deploying the Sample Application instructions to configure the application for the registry server you wish to use.


Querying Registry

This functionality allows user to search organizations in the registry for some input string.

  1. >cd <install_dir>/samples/webservices/jaxr/src/

  2. Execute the asant run-query command.

    • This performs a search in the registry specified in the query-url based on the query-string.

    • The query-url and query-string are read from <install_dir>/samples/webservices/jaxr/src/jaxr.properties.


Querying Registry Server for WSDL Services

This functionality allows the user to search organizations in the registry that offer services based on technical specifications that take the form of WSDL documents.

  1. >cd <install_dir>/samples/webservices/jaxr/src/

  2. Execute the asant run-query-wsdl command.

    • This performs a search in the registry specified in the query-url for WSDL services.

    • The query-url is read from <install_dir>/samples/webservices/jaxr/src/jaxr.properties.


Querying Registry Server for NAICS classification

This functionality allows the user to search a registry for organizations using an NAICS classification.

  1. >cd <install_dir>/samples/webservices/jaxr/src/

  2. Execute the asant run-query-naics command.

    • This performs a search in the registry specified in the query-url for organization using an NAICS classification.

    • The query-url is read from <install_dir>/samples/webservices/jaxr/src/jaxr.properties.


Publishing an Organization to Registry

This functionality allows the user to publish organizations to the registry. Modify the publish organization info section in <install_dir>/samples/webservices/jaxr/src/jaxr.properties with the appropriate information.

  1. >cd <install_dir>/samples/webservices/jaxr/src/

  2. Execute the asant run-publish command.

    • This publishes an organization to the registry specified in publish-url.

    • The query-url, publish-url, user authentication information, and organization information are read from <install_dir>/samples/webservices/jaxr/src/jaxr.properties.


Deleting an Organization from Registry

This functionality allows the user to delete an organization from the registry.

  1. >cd <install_dir>/samples/webservices/jaxr/src/

  2. Execute asant run-delete.

    • This deletes an organization with key=key-string from the registry.

    • The query-url, publish-url, user authentication information and key-string are read from <install_dir>/samples/webservices/jaxr/src/jaxr.properties.


Creating a classification scheme in Registry

This functionality allows the user to create a classification scheme and save it to the registry.

  1. >cd <install_dir>/samples/webservices/jaxr/src/

  2. Execute the asant run-save-scheme command.

    • This creates a classification scheme and save it into the registry specified in publish-url.

    • The query-url, publish-url, user authentication information, and organization information are read from <install_dir>/samples/webservices/jaxr/src/jaxr.properties.


Deleting a classification scheme from Registry

  1. cd <install_dir>/samples/webservices/jaxr/src/

  2. .Execute asant run-delete-scheme.

    • This deletes an organization with key=key-string for classification scheme from run-save-scheme operation.

    • The query-url, publish-url, user authentication information and key-string are read from <install_dir>/samples/webservices/jaxr/src/jaxr.properties.


Publishing an Organization with postal address to Registry

This functionality allows the user to publish organization with a contact person having postal address to the registry.

  • Be sure that you have executed run-save-scheme before trying this operation.

  • Please edit <install_dir>/samples/webservices/jaxr/src/postalconcepts.xml and replace uuid-from-save with the value returned by run-save-scheme operation.

  • Please edit <install_dir>/samples/webservices/jaxr/src/jaxr.properties and specify correct uuid-string.

  • >cd <install_dir>/samples/webservices/jaxr/src/

  • Execute the asant run-publish-postal command.

    • This publishes an organization to the registry specified in publish-url.

    • The query-url, publish-url, uuid-string and user authentication information are read from <install_dir>/samples/webservices/jaxr/src/jaxr.properties.


Querying Registry for organizations with postal address

This functionality allows user to search organizations in the registry for some input string. It displays the postal addresses the contacts of the organizations using the classification scheme created by run-save-scheme operation.

Please edit <install_dir>/samples/webservices/jaxr/src/jaxr.properties and specify correct uuid-string.

  1. >cd <install_dir>/samples/webservices/jaxr/src/

  2. Execute the asant run-query-postal command.

    • This performs a search in the registry specified in the query-url based on the query-string.

    • The query-url, uuid-string and query-string are read from <install_dir>/samples/webservices/jaxr/src/jaxr.properties.


Retrieving objects owned by a user from Registry

This functionality allows user to retrieve all the objects in the registry, owned by a user.

  1. >cd <install_dir>/samples/webservices/jaxr/src/

  2. Execute the asant run-query-objects command.

    • This retrieves all the objects owned by a user from the registry.

    • The query-url, publish-url and user authentication information are read from <install_dir>/samples/webservices/jaxr/src/jaxr.properties.


Command line Help

This target provides help on all of the above commands with examples. Try asant help under <install_dir>/samples/webservices/jaxr/src/.

If you want to override the jaxr.properties file, you can use command line arguments with asant commands.

For example, asant run-query -Dquery-string=Test

runs the command run-query and searches in the registry for query-string Test.



Troubleshooting



  • While running the sample, if you see the unknownUser error, verify the username and password.

  • While running the sample, if you see a no protocol or bad response error, verify that the query-url and publish-url are correct.

  • If you are unable to delete from the registry server and you see the invalidKeyPassed error, make certain that you are providing the correct key for the organization.

  • The following are the query-url and the publish-url for the IBM public registry server:

    • query-url=http://uddi.ibm.com/testregistry/inquiryapi

    • publish-url=https://uddi.ibm.com/testregistry/protect/publishapi

  • The following are the query-url and the publish-url for the Microsoft public registry server.

    • query-url=http://uddi.rte.microsoft.com/inquire

    • publish-url=https://uddi.rte.microsoft.com/publish

    Some Known Issues:
    • The application will not work, if there is firewall between the Registry Server and the Application Server. Please manually edit the source files to specify http proxy server. Please look at Java TM Web Services JAXR Tutorial for more information.


Copyright © 2002 Sun Microsystems, Inc. All rights reserved.

Last Updated July 25, 2002