Searching for Businesses

Our first example runs the UDDIProxy find_business( ) method and prints out the matching results. The program expects a single command-line argument, in which you specify the name of a business. For example, the following command line:

java com.ecerami.uddi.findBusiness Micro

generates the following output:

Searching for Businesses:  Micro
Microtrack, Inc.:  f53480ab-be29-4090-9239-f4c4a7cf71c6
Microform Reading Room:  622a4879-dcaa-4bab-9aec-6e6bfb858067
Micro Informatica LLC:  dce959cf-200d-4d9e-beee-ede770299212
Microsoft Corporation:  0076b468-eb27-42e5-ac09-9955cff462a3
Micromotor:  11bb5410-61d7-11d5-b286-002035229c64
MicroVideo Learning Systems:  8995b9f7-0043-4eb0-adaf-2aa81ad387e4
MicroApplications, Inc.:  a23c901e-834c-4b8a-bf38-3f96fedc349a
MicroLink LLC:  fb5783d6-4ba4-4bce-b181-4d3cd9f35e3d
MicroMain Corporation:  1e6c5410-00e7-4aee-acfb-fb59f3896322
Micro Motion Inc.:  d4e4b830-f19e-4edf-9f44-8936e53d9a33

The complete code is shown in Example 9-1. First, note that the findBusinessByName( ) method creates a new UDDIProxy object and specifies the inquiry URL for the Microsoft UDDI site. (For a complete list of inquiry and publishing URLs, refer to Chapter 7.)

The code then calls the proxy’s find_business( ) method:

BusinessList businessList = proxy.find_business(businessName, null, 0);

This method expects three arguments: a business name, a FindQualifier object, and a maximum number of records to return. In our case, we have no find qualifiers and therefore ...

Get Web Services Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.