UDDI4J samples
WAS provides a set of UDDI samples that illustrate how to publish and locate Web services, and how to perform error handling. These samples require that you have a connection to the Internet.
The samples are:
- FindExample is the "Hello World" of UDDI programs. It is the simplest sample of the UDDI API.
- SaveBusinessExample is an example of using the publish API. It logs into the server using the get_authToken() method; then attempts to save a business entity to the registry.
- DeleteBusinessExample searches for a particular business entity using the inquiry API, finds the associated businesskey, logs into the server, and then attempts to delete the business entity it found.
Use the UDDI samples
- Obtain a user ID and password for the IBM UDDI test registry.
The SaveBusinessExample and DeleteBusinessExample samples require that you have a valid user ID and password for the test UDDI registry.
Go to the IBM Web Services and UDDI Web site .
Register your user ID and password.
Activate your user ID and password.
Note: The test registry is sometimes not available. If this is the case, try registering your user ID and password at a later time.
By default the UDDI samples use the UDDI registry that you registered with above. If you are going to use a different UDDI registry, you'll need to edit the source code for the samples and specify the URL of the UDDI registry you going to use.
- Run the samples.
WAS provides an number of OS/400 scripts to run the samples from an OS/400 command prompt. IBM also provides UNIX scripts and DOS batch files to run the samples from a workstation platform on which you have mapped or mounted a drive to your iSeries server. These scripts add the required JAR files to the classpath. Use an iSeries editor or map a drive to your iSeries server and use a text editor to view the scripts. The script files describe the resources that you need to run the samples.
To run the samples on iSeries:
If you have not already done so, start Qshell by entering STRQSH on an OS/400 command prompt.
Change to the directory containing the scripts. The scripts are located in UDDISamples/os400_scripts, found in the SOAP examples directory of your WebSphere application server instance.
Invoke the script for the sample you want to test. For example, to invoke the FindExample sample, run the FindExample script.
To run the samples from a workstation:
In your workstation command prompt, navigate to the nt_scripts (Windows NT platform) directory or the unix_scripts (UNIX platforms) directory, located within the UDDISamples directory you opened in a previous step.
From the command prompt, invoke the script for the sample you want to test. All the scripts are named after the samples they run. For example, to invoke the FindExample sample, run the FindExample.sh script.
Note: A UDDI registry might limit the number of business entities that you publish. The IBM Test registry limits you to one business entity. This means, for example, that after running the SaveBusinessExample, run the DeleteBusinessExample before attempting to publish another business entity.
Note: When you run the DeleteBusinessExample sample, you might receive the following error messages:
Get authtoken Returned authToken:ADA3DC40-2531-11D5-9EB0-832611502FD0 Search for 'Sample business' to delete Found business key:D3DD4036-00E4-F124-050B-C6113996AA77 Errno:10140 ErrCode:E_userMismatch ErrText:E_userMismatch (10140) Cannot change data that is controlled by another party. businessEntity = D3DD4036-00E4-F124-050B-C6113996AA77 Found business key:61AE2CC0-0F2C-11D5-BC1E-B763254A2930 Errno:10140 ErrCode:E_userMismatch ErrText:E_userMismatch (10140) Cannot change data that is controlled by another party. businessEntity = 61AE2CC0-0F2C-11D5-BC1E-B763254A2930 Found business key:3BB274CF-00E3-FA94-9B72-C6113996AA77This is not a problem with the sample. DeleteBusinessExample issues a query for the business name specified in the code and receives a list of entries with that name. The sample then tries to delete each entry in the list. These error messages display when the sample tries to delete entries that you do not own.