InfoCenter Home >
4: Developing applications >
4.8: Web services - an overview >
4.8.1: Web services components >
4.8.1.1: UDDI4J Overview >
4.8.1.1.1: UDDI4J samples
4.8.1.1.1: UDDI4J samples
A set of samples is provided to illustrate
using the inquiry and publish
APIs, and to demonstrate error handling.
Note: WebSphere Application Server does not
provide a UDDI registry. The IBM UDDI test registry is located at
www.ibm.com/services/uddi/
Any sample that requires you to "publish," "save," or "delete" requires a
userid and password. You can only invoke the "find" sample without a userid and password.
To get a userid and password:
- Access the UDDI test registry
- Register for your userid and password
The registration process requires you to activate your id before
attempting to use the publish or delete examples.
Note: If the registry is not operational, keep trying. This is a test registry and
at times it is not available.
- Use your registered userid and password when running the SaveBusinessExample
and DeleteBusinessExample samples.
Your samples consist of:
- 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.
- DeleteBusinessExample - searches for a particular
business using the inquiry API, finds the
associated businesskey, logs into the server, and
then attempts to delete the business it found.
When running DeleteBusinessExample, 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-C6113996AA77
This 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 occur when the sample tries to delete entries that you do not own.
Accessing the samples
To access these samples, you can either install
the soapsamples.ear, or you can
expand the soapsamples.ear using the EarExpander
tool.
These are the steps to access the samples:
- Create a directory to hold the expanded soapsamples.ear
contents.
- From the product_installation_root\bin directory,
enter the following commands:
EarExpander -ear ..\installableApps\soapsamples.ear
-expandDir ..\temp\soapsamples -operation
expand -expansionFlags war
- Issue the cd command to change to the
installedApps/soapsamples.ear or
to the target directory specified in the
-expandDir argument
- Issue the cd command to change to
UDDISamples directory. The source for the samples
is included in the src directory.
The samples require several pieces of information.
The sample source files can be edited and these values
substituted. The required values are:
- InquiryURL: The URL of the UDDI server against which to
run inquiries.
- PublishURL: The URL of the UDDI server to
run publish requests. Typically, this is a
SSL connection.
- Userid: When publishing, a userid is required
for authentication.
- Password: This is the password for the referenced userid.
Password is referred to as a credential in UDDI terminology.
Running the samples
WebSphere Application Server provides an number of UNIX scripts and DOS .bat files
to run the samples. These scripts (or .bat files) add the required jar files to
the classpath. Use a text editor (such as Notepad on Windows NT or VI or E3 on UNIX) to view the scripts (or .bat files). They describe
the resources that you need to run the samples.
The scripts are located in directory UDDISamples/unix_scripts.
On Windows NT, the .bat files are located in directory UDDISamples\nt_bat.
The scripts are put in this location
as a result of running the EarExpander
command.
All the scripts (or .bat files) are named after the samples they run.
So, for example, to invoke the FindExample sample, you would run the
FindExample.sh script.
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, you
must run the DeleteBusinessExample before attempting to publish another
business entity.
See the related information links for an enablement scenario.
|
|