The JavaTM Web Services Tutorial
Home
TOC
Index
PREV TOP NEXT
Divider

Using the Command Line Client Script with the Registry Server

You will find shell scripts in the <JWSDP_HOME>/samples/registry-server directory called registry-server-test.sh (for UNIX systems) and registry-server-test.bat (for Microsoft Windows systems).

The script uses XML files in the xml subdirectory to send messages to the Registry Server.

To use the script, go to the directory where the script resides. Make sure the script is executable (make it so if it is not).

You can use the script to perform the following tasks:

Obtaining Authentication

Before you can perform other tasks, you must obtain authentication as a user of the Registry Server.

To obtain authentication, you use the file GetAuthToken.xml in the xml subdirectory. By default, the registry accepts a default user named testuser with a password of testuser. To create other users, follow the instructions in Adding New Users to the Registry, then edit the GetAuthToken.xml file to specify the user name and password you created.

To obtain authentication, enter the following command on one line:

Windows:

registry-server-test run-cli-request 
  -Drequest=xml\GetAuthToken.xml
 

UNIX:

registry-server-test.sh run-cli-request 
  -Drequest=xml/GetAuthToken.xml
 

When the script runs, it returns an <authToken> tag that contains an <authInfo> tag. You will use the value in this tag in the next step.

The value in this tag is valid for one hour. You can rerun the script after it expires.

Saving a Business

To save (that is, to add) a business, you use the file SaveBusiness.xml in the xml subdirectory. Before you run the script, edit the <authInfo> tag in this file and replace the existing contents with the contents of the <authInfo> tag returned in the previous step. Feel free to modify other values specified in the file.

To save the business, enter the following command on one line:

Windows:

registry-server-test run-cli-request 
  -Drequest=xml\SaveBusiness.xml
 

UNIX:

registry-server-test.sh run-cli-request 
  -Drequest=xml/SaveBusiness.xml
 

Output appears in the terminal window in which you run the command.

Finding a Business

To find a business by name, you use the file FindBusiness.xml in the xml subdirectory.

Before you run the script this time, edit the file by changing the value in the <name> tag to the name you specified in the SaveBusiness.xml file.

To find the business, use the following command:

Windows:

registry-server-test run-cli-request 
  -Drequest=xml\FindBusiness.xml
 

UNIX:

registry-server-test.sh run-cli-request 
  -Drequest=xml/FindBusiness.xml
 

Output appears in the terminal window. Notice the businessKey value returned in the <businessEntity> tag. You will use it in the next step.

Obtaining Business Details

To obtain details about a business, you use the file GetBusinessDetail.xml in the xml subdirectory.

Before you run the script this time, edit this file by copying the businessKey value from the output of the command in the previous step into the <businessKey> tag.

To obtain details about the business you saved, use the following command:

Windows:

registry-server-test run-cli-request 
  -Drequest=xml\GetBusinessDetail.xml
 

UNIX:

registry-server-test.sh run-cli-request 
  -Drequest=xml/GetBusinessDetail.xml
 

Output appears in the terminal window.

Deleting a Business

To delete a business you saved, you use the file DeleteBusiness.xml in the xml subdirectory.

Before you run the script this time, edit the file as follows:

  1. Change the value of the <authInfo> tag to the value you used for SaveBusiness.xml.
  2. Change the value of the <businessKey> tag to the business key value of the business you want to delete.

To delete the business, use the following command:

Windows:

registry-server-test run-cli-request 
  -Drequest=xml\DeleteBusiness.xml
 

UNIX:

registry-server-test.sh run-cli-request 
  -Drequest=xml/DeleteBusiness.xml
 

Validating UDDI Messages

To validate a UDDI message against the UDDI V2.0 XML schema before you send it, use the following command:

registry-server-test run-validate -Dinstance=XML_file_name
 

If a file contains errors, the error messages have the following format:

file:line:column:message
 

Retrieving a User's Businesses

To obtain a summary of all items published by a user, you use the file GetRegisteredInfo.xml in the xml subdirectory.

Before you run the script this time, edit this file by copying the <authInfo> string that you entered in the SaveBusiness.xml or DeleteBusiness.xml file into the <authInfo> tag of GetRegisteredInfo.xml.

To obtain details about the business you saved, use the following command:

Windows:

registry-server-test run-cli-request 
  -Drequest=xml\GetRegisteredInfo.xml
 

UNIX:

registry-server-test.sh run-cli-request 
  -Drequest=xml/GetRegisteredInfo.xml
 

Sending UDDI Request Messages

To send any UDDI request to the server, use the following command:

registry-server-test run-cli-request -Drequest=name_of_file
 

where name_of_file is an XML file containing a UDDI message. It is a good idea to validate the message before you send it.

The xml subdirectory contains numerous messages you can edit and use in addition to those described here. You can also create your own messages.

Divider
Home
TOC
Index
PREV TOP NEXT
Divider

This tutorial contains information on the 1.0 version of the Java Web Services Developer Pack.

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