The objective of this lesson is to learn how to find service information in an UDDI registry.
This lesson can be completed with lesson 7, "Saving a service", as well as with lesson 11, "Deleting a service".
The UDDI Programmer's API defines the messages to be used to find information from an UDDI registry. Among them, the find_service message studied in this lesson allows finding high-level information on a business service. The UDDI registry reply is a serviceList message. More detailed information on a business service can then be obtained, if needed, using the get_serviceDetail 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 business services. In this example, we are searching for a "Consulting" business service:
BusinessKey businessKey = null; // don't search within a specific business entity
ServiceList serviceList = querier.findService(businessKey, new Name("Consulting"));
The UDDIQuerier methods all throw RemoteException and UDDIException , not catched here for clarity. The returned ServiceList can be further decomposed at the required level of granularity.
ServiceInfos serviceInfos = serviceList.getServiceInfos();
ServiceInfo _serviceInfos[] = serviceInfo.toArray();
for(int i=0; i< _serviceInfos.length; i++) {
ServiceInfo serviceInfo = _serviceInfos[i];
Names names = serviceInfo.getNames();
System.out.println("ServiceInfo #" + i + ": " + (names.toArray())[0]);
}
|
|
(c) INSPIRE IT, 2003 | Send us your feedback: developers@ruddi.biz