The objective of this lesson is to learn how to save a business service in a UDDI registry.
The UDDI Programmer's API defines the messages to be used to save information in an UDDI registry. Among them, the save_service message studied in this lesson allows saving business service information. The UDDI registry reply is a serviceDetail message returning the business service information as it has been saved in the UDDI registry.
We first create an UDDIProfile and set, in this example, the publishing 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.publishing.url","http://uddi.microsoft.com/publish");
profile.setProperty("inspireit.uddi.version","2.0");
An UDDIPublisher to publish to the UDDI registry can be instantiated using the static getPublisher( UDDIProfile ) method:
UDDIPublisher publisher = UDDIPublisher.getPublisher(profile);
UDDIPublisher comes with a set of methods to publish information to UDDI registries. To publish business service information, we use one of the available saveService() methods. For example:
BusinessService businessService = ... // the business service to publish
ServiceDetail serviceDetail = publisher.saveService(businessService);
The UDDIPublisher methods all throw RemoteException and UDDIException , not catched here for clarity. The returned ServiceDetail provides a complete view on the way the business service (or business services) has (or have) been saved, such as the service key(s) that has (or have) been computed to uniquely tag the information in the UDDI registry.
The following code shows how the returned ServiceDetail can be decomposed at the level of granularity required to access the service key information:
BusinessServices businessServices = serviceDetail.getBusinessServices();
BusinessService _businessServices[] = businessServices.toArray();
for(int i=0; i< _businessServices.length; i++) {
BusinessService businessService = _businessServices[i];
ServiceKey serviceKey = businessService.getServiceKey();
System.out.println("ServiceKey #" + i + ": " + serviceKey);
}
|
|
(c) INSPIRE IT, 2003 | Send us your feedback: developers@ruddi.biz