Download FAQ History |  | API Search Feedback

> ## 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 Java WSDP Registry Server for queries and updates; you can specify any other UDDI version 2 registry.

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

> - `JAXRQuery.java` shows how to search a registry for organizations
> - `JAXRQueryByNAICSClassification.java` shows how to search a registry using a common classification scheme
> - `JAXRQueryByWSDLClassification.java` shows how to search a registry for Web services that describe themselves by means of a WSDL document
> - `JAXRPublish.java` shows how to publish an organization to a registry
> - `JAXRDelete.java` shows how to remove an organization from a registry
> - `JAXRSaveClassificationScheme.java` shows how to publish a classification scheme (specifically, a postal address scheme) to a registry
> - `JAXRPublishPostal.java` shows how to publish an organization with a postal address for its primary contact
> - `JAXRQueryPostal.java` shows how to retrieve postal address data from an organization
> - `JAXRDeleteScheme.java` shows how to delete a classification scheme from a registry
> - `JAXRGetMyObjects.java` lists all the objects that you own in a registry

> The `<``INSTALL``>/jwstutorial12/examples/jaxr/` directory also contains:

> - A `build.xml` file for the examples
> - A `JAXRExamples.properties` file, in the `src` subdirectory, that supplies string values used by the sample programs
> - A file called `postalconcepts.xml` that you use with the postal address examples

> ### Before You Compile the Examples

> Before you compile the examples, edit the file `<``INSTALL``>/jwstutorial12/examples/jaxr/JAXRExamples.properties` as follows.

> 1. Edit the following lines in the `JAXRExamples.properties` file 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 Java WSDP Registry Server, so if you will be using the Registry Server on your own system, you do not need to change this section.

> `## Uncomment one pair of query and publish URLs.
> ## IBM:
> #query.url=http://uddi.ibm.com/testregistry/inquiryapi
> #publish.url=https://uddi.ibm.com/testregistry/publishapi
> ## Microsoft:
> #query.url=http://test.uddi.microsoft.com/inquire
> #publish.url=https://test.uddi.microsoft.com/publish
> ## Registry Server:
> query.url=http://localhost:8080/RegistryServer
> publish.url=http://localhost:8080/RegistryServer`

> If the Java WSDP Registry Server 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`. If Tomcat is using a nondefault port, change `8080` to the correct value for your system.

> 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 Java WSDP Registry Server 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.

> 2. Edit the following lines in the `JAXRExamples.properties` file to specify the user name and password you obtained when you registered with the registry. The defaults are the Registry Server default username and password.

> `## Specify username and password if needed
> ## testuser/testuser are defaults for Registry Server
> registry.username=testuser
> registry.password=testuser`

> 3. If you will be using a public registry, edit the following lines in the `JAXRExamples.properties` file, 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 Java WSDP Registry Server.

> `## HTTP and HTTPS proxy host and port;
> ## ignored by Registry Server
> 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`

> 4. Feel free to change any of the organization data in the remainder of the file. This data is used by the publishing and postal address examples.

> You can edit the `JAXRExamples.properties` file at any time. The `Ant` targets that run the client examples will use the latest version of the file.

> ### Compiling the Examples

> To compile the programs, go to the`<``INSTALL``>/jwstutorial12/examples/jaxr/` directory. A `build.xm`l file allows you to use the command

>     ant compile

> to compile all the examples. The `Ant` tool creates a subdirectory called `build`.

> The runtime classpath setting in the `build.xml` file includes JAR files in several directories in the Java WSDP installation. All JAXR client examples require this classpath setting.

> ### Running the Examples

> Some of the `build.xml` targets for running the examples contain commented-out `<sysproperty>` tags that set the JAXR logging level to debug and set other connection properties. These tags are provided to illustrate how to specify connection properties. Feel free to modify or delete these tags.

> If you are running the examples with the Java WSDP Registry Server, start the Java WSDP Tomcat:

> Windows:

>     startup

> UNIX:

>     startup.sh

> The Registry Server is a Web application that is loaded when Tomcat starts.

> You do not need to start Tomcat in order to run the examples against public registries.

> #### Running the JAXRPublish Example

> To run the `JAXRPublish` program, use the `run-publish` target with no command line arguments:

>     ant run-publish

> The program output displays the string value of the key of the new organization, which is named "The Coffee Break."

> 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, use the `Ant` target `run-query`. Specify a `query-string` argument on the command line to search the registry for organizations whose names contain that string. For example, the following command line searches for organizations whose names contain the string "coff" (searching is not case-sensitive):

>     ant -Dquery-string=coff run-query

> #### 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 do so, use the `Ant` target `run-query-naics`:

>     ant run-query-naics

> #### Running the JAXRDelete Example

> To run the `JAXRDelete` program, specify the key string returned by the `JAXRPublish` program as input to the `run-delete` target:

>     ant -Dkey-string=keyString run-delete

> #### Running the JAXRQueryByWSDLClassification Example

> You can run the `JAXRQueryByWSDLClassification` example at any time. Use the `Ant` target `run-query-wsdl`:

>     ant run-query-wsdl

> 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, use the target `run-save-scheme`:

>     ant run-save-scheme

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

> You do not have to run this program if you are using the Java WSDP Registry Server, because it does not validate these objects.

> 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

> Before you run the postal address examples, open the file `postalconcepts.xml` in an editor. Wherever you see the string `uuid-from-save`, replace it with the UUID string returned by the `run-save-scheme` target. For the Java WSDP Registry Server, you may use any string that is formatted as a UUID.

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

> 1. Run the `JAXRPublishPostal` program. Notice that in the `build.xml` file, the `run-publish-postal` target contains a `<sysproperty>` tag that sets the `userTaxonomyFilenames` property to the location of the `postalconcepts.xml` file in the current directory:

> `<sysproperty
> key="com.sun.xml.registry.userTaxonomyFilenames"
> value="postalconcepts.xml"/>`

> Specify the string you entered in the `postalconcepts.xml` file as input to the `run-publish-postal` target:

> `ant -Duuid-string=``uuidstring` `run-publish-postal`

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

> 2. Run the `JAXRQueryPostal` program. The `run-query-postal` target contains the same `<sysproperty>` tag as the `run-publish-postal` target.

> As input to the `run-query-postal` target, specify both a `query-string` argument and a `uuid-string` argument on the command line to search the registry for the organization published by the `run-publish-postal` target:

> `ant -Dquery-string=coffee
> -Duuid-string=``uuidstring` `run-query-postal`

> 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.

> 3. 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

> To delete the classification scheme you published after you have finished using it, run the `JAXRDeleteScheme` program using the `run-delete-scheme` target:

>     ant -Duuid-string=uuidstring run-delete-scheme

> 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.

> #### 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 by using the `run-get-objects` target:

>     ant run-get-objects

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

> #### Other Targets

> To remove the `build` directory and class files, use the command

>     ant clean

> To obtain a syntax reminder for the targets, use the command

>     ant -projecthelp

Download FAQ History |  | API Search Feedback

All of the material in The Java(TM) Web Services Tutorial is copyright-protected and may not be published in other works without express written permission from Sun Microsystems.