Home
TOC Index |
Using the Command Line Client Script with the Registry Server
You will find shell scripts in the
<
JWSDP_HOME
>
/samples/registry-server
directory calledregistry-server-test.sh
(for UNIX systems) andregistry-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
- Saving a business
- Finding a business
- Obtaining business details
- Deleting a business
- Validating messages
- Retrieving a particular user's businesses
- Sending any kind of UDDI message
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 thexml
subdirectory. By default, the registry accepts a default user namedtestuser
with a password oftestuser
. To create other users, follow the instructions in Adding New Users to the Registry, then edit theGetAuthToken.xml
file to specify the user name and password you created.To obtain authentication, enter the following command on one line:
registry-server-test run-cli-request -Drequest=xml\GetAuthToken.xmlregistry-server-test.sh run-cli-request -Drequest=xml/GetAuthToken.xmlWhen 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 thexml
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:
registry-server-test run-cli-request -Drequest=xml\SaveBusiness.xmlregistry-server-test.sh run-cli-request -Drequest=xml/SaveBusiness.xmlOutput 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 thexml
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 theSaveBusiness.xml
file.To find the business, use the following command:
registry-server-test run-cli-request -Drequest=xml\FindBusiness.xmlregistry-server-test.sh run-cli-request -Drequest=xml/FindBusiness.xmlOutput 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 thexml
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:
registry-server-test run-cli-request -Drequest=xml\GetBusinessDetail.xmlregistry-server-test.sh run-cli-request -Drequest=xml/GetBusinessDetail.xmlOutput appears in the terminal window.
Deleting a Business
To delete a business you saved, you use the file
DeleteBusiness.xml
in thexml
subdirectory.Before you run the script this time, edit the file as follows:
- Change the value of the
<authInfo>
tag to the value you used forSaveBusiness.xml
.- 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:
registry-server-test run-cli-request -Drequest=xml\DeleteBusiness.xmlregistry-server-test.sh run-cli-request -Drequest=xml/DeleteBusiness.xmlValidating 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:messageRetrieving a User's Businesses
To obtain a summary of all items published by a user, you use the file
GetRegisteredInfo.xml
in thexml
subdirectory.Before you run the script this time, edit this file by copying the
<authInfo>
string that you entered in theSaveBusiness.xml
orDeleteBusiness.xml
file into the<authInfo>
tag ofGetRegisteredInfo.xml
.To obtain details about the business you saved, use the following command:
registry-server-test run-cli-request -Drequest=xml\GetRegisteredInfo.xmlregistry-server-test.sh run-cli-request -Drequest=xml/GetRegisteredInfo.xmlSending 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.
Home
TOC Index |
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.