The objective of this lesson is to learn how to find business information in an UDDI registry.
This lesson can be completed with lesson 5, "Getting details on a business", as well as with lesson 6, "Saving a business" and 10, "Deleting a business".
The UDDI Programmer's API defines the messages to be used to find information from an UDDI registry. Among them, the find_business message studied in this lesson allows finding high-level information on a business. The UDDI registry reply is a businessList message. More detailed information on a business can then be obtained, if needed, using a get_businessDetail call.
We first create an UDDIProfile and set, in this example, the inquiry URL to Microsoft's UBR. We will also use UDDI 2.0 for the interactions with the UDDI registry:
UDDIProfile profile = new UDDIProfile();
profile.setProperty("inspireit.uddi.inquiry.url","http://uddi.microsoft.com/inquire");
profile.setProperty("inspireit.uddi.version","2.0");
An UDDIQuerier to query the UDDI registry can be instantiated using the static getQuerier(UDDIProfile) method:
UDDIQuerier querier = UDDIQuerier.getQuerier(profile);
UDDIQuerier comes with a set of methods to search high-level information on businesses stored in an UDDI registry. In this example, we are searching for the INSPIRE IT business entity:
BusinessList businessList = querier.findBusiness(new Name("INSPIRE IT"));
The UDDIQuerier methods all throw RemoteException and UDDIException , not catched here for clarity. The returned BusinessList can be further decomposed at the required level of granularity.
BusinessInfos businessInfos = businessList.getBusinessInfos();
BusinessInfo _businessInfos[] = businessInfos.toArray();
for(int i=0; i< _businessInfos.length; i++) {
BusinessInfo businessInfo = _businessInfos[i];
Names names = businessInfo.getNames();
System.out.println("BusinessInfo #" + i + ": " + (names.toArray())[0]);
}
|
|
(c) INSPIRE IT, 2003 | Send us your feedback: developers@ruddi.biz