The JavaTM Web Services Tutorial
Home
TOC
PREV TOP NEXT

Using the Command Line Client Script with the Registry Server

You will find a shell script called <JWSDP_HOME>/samples/registry-server/registry-server-test.sh (on UNIX systems) or <JWSDP_HOME>\samples\registry-server\registry-server-test.bat (on 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:

  1. 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.
  2. Save a business (that is, add a business).
    To save 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.
  3. Find 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.
  4. Obtain 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.
  5. Delete 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
     
    
  6. Validate 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
     
    
  7. Send any UDDI request message.
    To send a 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
PREV TOP NEXT