FAQ
History
PreviousHomeNext Search
Feedback
Divider

Running the Client Examples

The simple client programs provided with this tutorial can be run from the command line. You can modify them to suit your needs. They allow you to specify the IBM registry, the Microsoft registry, or the Registry Server for queries and updates; you can specify any other UDDI version 2 registry.

The client examples, in the <INSTALL>/j2eetutorial/examples/jaxr directory, are as follows:

The <INSTALL>/j2eetutorial/examples/jaxr directory also contains:

The instructions that follow assume that you have started Sun ONE Studio. You do not need to have the Sun ONE Application Server running in order to use JAXR.

Mounting the Filesystem

Before you can compile the examples, you must mount the filesystem. To do so:

  1. Select the Filesystems tab of the Explorer.
  2. Choose Mount Filesystem from the File menu.
  3. Mount the following directory:
  4. <INSTALL>/j2eetutorial/examples/jaxr 
    

Editing the Properties File

Before you compile the examples, edit the file JAXRExamples.properties as follows.

  1. Right-click the file and choose the Edit menu item.
  2. Edit the following lines to specify the registry you wish to access. For both the queryURL and the publishURL assignments, comment out all but the registry you wish to access. The default is the Sun ONE Studio internal UDDI Server Registry, so if you will be using this registry on your own system, you do not need to change this section.
  3. ## Uncomment one pair of query and publish URLs.
    ## IBM:
    #query.url=http://uddi.ibm.com/testregistry/inquiryapi
    #publish.url=https://uddi.ibm.com/testregistry/protect/
    publishapi
    ## Microsoft:
    #query.url=http://test.uddi.microsoft.com/inquire
    #publish.url=https://test.uddi.microsoft.com/publish
    ## Registry Server:
    query.url=http://localhost:8089/registry-server/
    RegistryServerServlet
    publish.url=http://localhost:8089/registry-server/
    RegistryServerServlet

    If the internal UDDI Server Registry is running on a system other than your own, specify the fully qualified host name instead of localhost. Do not use https: for the publishURL.

    The IBM and Microsoft registries both have a considerable amount of data in them that you can perform queries on. Moreover, you do not have to register if you are only going to perform queries.

    We have not included the URLs of the SAP registry; feel free to add them.

    If you want to publish to any of the public registries, the registration process for obtaining access to them is not difficult (see Preliminaries: Getting Access to a Registry). Each of them, however, allows you to have only one organization registered at a time. If you publish an organization to one of them, you must delete it before you can publish another. Since the organization that the JAXRPublish example publishes is fictitious, you will want to delete it immediately anyway.

    The internal UDDI Server Registry gives you more freedom to experiment with JAXR. You can publish as many organizations to it as you wish. However, this registry comes with an empty database, so you must publish organizations to it yourself before you can perform queries on the data.

  4. Edit the following lines to specify the user name and password you obtained when you registered with the registry. The default is the internal UDDI Server Registry default password.
  5. ## Specify username and password if needed
    ## testuser/testuser are defaults for internal Registry
    registry.username=testuser
    registry.password=testuser

  6. If you will be using a public registry, edit the following lines, which contain empty strings for the proxy hosts, to specify your own proxy settings. The proxy host is the system on your network through which you access the Internet; you usually specify it in your Internet browser settings. You can leave this value empty to use the internal UDDI Server Registry.
  7. ## HTTP and HTTPS proxy host and port;
    ## ignored by internal Registry
    http.proxyHost=
    http.proxyPort=8080
    https.proxyHost=
    https.proxyPort=8080

    The proxy ports have the value 8080, which is the usual one; change this string if your proxy uses a different port.

    For a public registry, your entries usually follow this pattern:

    http.proxyHost=proxyhost.mydomain
    http.proxyPort=8080
    https.proxyHost=proxyhost.mydomain
    https.proxyPort=8080

  8. Feel free to change any of the organization data in the remainder of the file. This data is used by the publishing examples, JAXRPublish and JAXRPublishPostal.
  9. Save and close the file.

You can edit the JAXRExamples.properties file at any time. When you run the client examples, they use the latest version of the file.

Starting the Internal UDDI Server Registry

If you plan to use the internal UDDI Server Registry, perform the following steps:

  1. Select the Runtime tab of the Explorer.
  2. Expand the UDDI Server Registry node.
  3. Right-click the Internal UDDI Registry node and choose the Start Server menu item.

Setting the Compilation Classpath

Before you can compile the programs, you need to set the compilation classpath. To do so:

  1. Choose Options from the Tools menu.
  2. Expand the Building node, then the Compiler Types node.
  3. Choose External Compilation.
  4. Select the Expert tab.
  5. Click the Class Path property, then double-click the ellipsis in the value field.
  6. In the property editor, click Add JAR/Zip.
  7. In the file chooser, navigate to the directory <S1STUDIO_HOME>/jwsdp/common/lib and choose the jaxr-api.jar file. (This file is also in <S1AS7_HOME>/share/lib.)
  8. Click OK.
  9. Click OK in the property editor, then click Close in the Options window.

Compiling the Examples

To compile the programs:

  1. In the Filesystems tab of the Explorer, right-click the <INSTALL>/j2eetutorial/examples/jaxr directory.
  2. Choose the Compile All menu item.

Compiler messages appear in an output window.

Running the JAXRPublish Example

To run the JAXRPublish program, right-click the file in the Filesystems tab and choose the Execute menu item.

The program output appears in an output window associated with the Running tab of the main window. It displays the string value of the key of the new organization, which is named "The Coffee Break."

Do not dismiss the output window. You'll need its contents in the future. Return to the Editing tab to continue running the examples.

After you run the JAXRPublish program but before you run JAXRDelete, you can run JAXRQuery to look up the organization you published.

Running the JAXRQuery Example

To run the JAXRQuery example:

  1. Click the JAXRQuery file in the Filesystems tab.
  2. In the property window for the file, choose the Execution tab.
  3. Click Arguments.
  4. Enter a string in the value field, such as coffee.
  5. Right-click the JAXRQuery file in the Filesystems tab and choose the Execute menu item.

The program searches the registry for organizations whose names contain the string you specified. Searching is not case-sensitive.

Running the JAXRQueryByNAICSClassification Example

After you run the JAXRPublish program, you can also run the JAXRQueryByNAICSClassification example, which looks for organizations that use the "Snack and Nonalcoholic Beverage Bars" classification, the same one used for the organization created by JAXRPublish.

To run the program, right-click the JAXRQueryByNAICSClassification file in the Filesystems tab and choose the Execute menu item

Running the JAXRDelete Example

To run the JAXRDelete example, you need to provide the key returned by the JAXRPublish program. Perform the following steps:

  1. Click the Running tab in the main window.
  2. In the Output window tab for the JAXRPublish example, select the organization key value from the program output. It looks something like f2c2827a-b1f2-c282-3fd27a5c1893. Right-click in the window and choose the Copy menu item.
  3. Click the JAXRDelete file in the Filesystems tab.
  4. In the property window for the file, choose the Execution tab.
  5. Click Arguments.
  6. Paste the key string you copied in step 2 into the value field.
  7. Right-click the JAXRDelete file in the Filesystems tab and choose the Execute menu item.

The program deletes the specified organization from the registry.

Running the JAXRQueryByWSDLClassification Example

To run the JAXRQueryByWSDLClassification example, right-click the file in the Filesystems tab and choose the Execute menu item.

This example returns many results from the public registries and is likely to run for several minutes.

Publishing a Classification Scheme

In order to publish organizations with postal addresses to public registries, you must publish a classification scheme for the postal address first.

To run the JAXRSaveClassificationScheme program, right-click the file in the Filesystems tab and choose the Execute menu item.

The program returns a UUID string, which you will use in the next section.

The public registries allow you to own more than one classification scheme at a time (the limit is usually a total of about 10 classification schemes and concepts put together).

Running the Postal Address Examples

Running the postal address examples involves the following steps:

  1. Specifying the UUID of the classification scheme in the postalconcepts.xml file
  2. Specifying the pathname of the postalconcepts.xml file in the postal.properties file
  3. Running the JAXRPublishPostal example
  4. Running the JAXRQueryPostal example

Specifying the UUID

Before you run the postal address examples, you need to specify the UUID of the classification scheme in the postalconcepts.xml file:

  1. Click the Running tab in the main window.
  2. In the Output window tab for the JAXRSaveClassificationScheme example, select the postal scheme key value from the program output. It looks something like this: uuid:f2be7262-aff2-be76-b3fa-ddd3e4e600f5. Right-click in the window and choose the Copy menu item.
  3. Right-click the file postalconcepts.xml and choose the Edit menu item.
  4. Wherever you see the string uuid-from-save, replace it with the UUID string you copied in step 2.
  5. Save and close the file.

For a given registry, you only need to save the classification scheme and edit postalconcepts.xml once. After you perform those steps, you can run the JAXRPublishPostal and JAXRQueryPostal programs multiple times.

Editing the Properties File

Next, edit the postal.properties file to specify the correct pathname for the postalconcepts.xml file:

  1. Right-click the file postal.properties and choose the Edit menu item.
  2. Specify the correct pathname for the postalconcepts.xml file. On a UNIX system the pathname may be relative, but on a Windows system it must be absolute and must be specified using double backslashes. For example, you might enter the following (all on one line):
  3. com.sun.xml.registry.userTaxonomyFilenames=D:\\Sun\\AppServer7
    \\docs\\tutorial\\examples\\jaxr\\postalconcepts.xml 
    

Running the JAXRPublishPostal Example

The JAXRPublishPostal example uses the postal.properties file to set the system property com.sun.xml.registry.userTaxonomyFilenames to the correct location of the postalconcepts.xml file. You need to specify this file and the UUID string of the classification scheme as command-line arguments.

  1. Click the JAXRPublishPostal file in the Filesystems tab.
  2. In the property window for the file, choose the Execution tab.
  3. Click Arguments, then double-click the ellipsis to bring up the property editor.
  4. Enter the pathname of the postal.properties file and the UUID string of the classification scheme. On a Windows system, you must specify the full pathname. For example, you might specify the following, all on one line:
  5. D:\MyTutorial\j2eetutorial\examples\jaxr\
    postal.properties uuid:f2be7262-aff2-be76-b3fa-ddd3e4e600f5 
    
  6. Click OK. Notice that on a Windows system, the pathname appears with double backslashes.
  7. Right-click the JAXRPublishPostal file and choose the Execute menu item.

The program output displays the string value of the key of the new organization.

Running the JAXRQueryPostal Example

Like the JAXRPublishPostal example, the JAXRQueryPostal example expects the postal.properties file pathname and the UUID string as command-line arguments. It also expects a query string.

  1. Click the JAXRQueryPostal file in the Filesystems tab.
  2. In the property window for the file, choose the Execution tab.
  3. Click Arguments, then double-click the ellipsis to bring up the property editor.
  4. Enter the pathname of the postal.properties file, the query string, and the UUID string of the classification scheme. On a Windows system, you must specify the full pathname. For example, you might specify the following, all on one line:
  5. D:\\Sun\\AppServer7\\docs\\tutorial\\examples\\jaxr\\
    postal.properties coffee uuid:f2be7262-aff2-be76-b3fa-
    ddd3e4e600f5 
    
  6. Right-click the JAXRQueryPostal file and choose the Execute menu item.
  7. The postal address for the primary contact will appear correctly with the JAXR PostalAddress methods. Any postal addresses found that use other postal address schemes will appear as Slot lines.

  8. If you are using a public registry, make sure to follow the instructions in Running the JAXRDelete Example to delete the organization you published.

Deleting a Classification Scheme

You may or may not want to delete the classification scheme you published. For a UDDI registry, deleting a classification scheme removes it from the registry logically but not physically. You can no longer use the classification scheme, but it will still be visible if, for example, you call the method QueryManager.getRegisteredObjects. Since the public registries allow you to own up to 10 of these objects, this is not likely to be a problem. However, once you have created a classification scheme for postal addresses in a public registry, you may want to leave it there for future use.

The Sun ONE Studio internal UDDI Server Registry imposes no limit on the number of classification schemes you can own.

To delete the classification scheme you published after you have finished using it, run the JAXRDeleteScheme program as follows:

  1. Click the Running tab in the main window.
  2. In the Output window tab for either the JAXRSaveClassificationScheme, JAXRPublishPostal, or JAXRQueryPostal example, select the value of the UUID string from the program output. Right-click in the window and choose the Copy menu item.
  3. Click the JAXRDeleteScheme file in the Filesystems tab.
  4. In the property window for the file, choose the Execution tab.
  5. Click Arguments.
  6. Paste the UUID string you copied in step 2 into the value field.
  7. Right-click the JAXRDeleteScheme file in the Filesystems tab and choose the Execute menu item.

The program deletes the specified classification scheme from the registry.

Getting a List of Your Registry Objects

To get a list of the objects you own in the registry, both organizations and classification schemes, run the JAXRGetMyObjects program.

Right-click the file in the Filesystems tab and choose the Execute menu item.

If you run this program with the Registry Server, it returns all the standard UDDI taxonomies provided with the Registry Server, not just the objects you have created.

Stopping the Internal UDDI Server Registry

If you started the internal UDDI Server Registry, perform the following steps after you have finished using the examples:

  1. Select the Runtime tab of the Explorer.
  2. Expand the UDDI Server Registry node.
  3. Right-click the Internal UDDI Registry node and choose the Stop Server menu item.
Divider
FAQ
History
PreviousHomeNext Search
Feedback
Divider

All of the material in The J2EE Tutorial for the Sun ONE Platform is copyright-protected and may not be published in other works without express written permission from Sun Microsystems.