The objective of this lesson is to learn how to save a binding template 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_binding message studied in this lesson allows saving binding template information. The UDDI registry reply is a bindingDetail message returning the binding template 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 binding template information, we use one of the available saveBinding() methods. For example:
BindingTemplate bindingTemplate = ... // the binding template to publish
BindingDetail bindingDetail = publisher.saveBinding(bindingTemplate);
The UDDIPublisher methods all throw RemoteException and UDDIException , not catched here for clarity. The returned BindingDetail provides a complete view on the way the binding template (or binding templates) has (or have) been saved, such as the binding key(s) that has (or have) been computed to uniquely tag the information in the UDDI registry.
The following code shows how the returned BindingDetail can be decomposed at the level of granularity required to access the service key information:
BindingTemplates bindingTemplates = bindingDetail.getBindingTemplates();
BindingTemplate _bindingTemplates[] = bindingTemplates.toArray();
for(int i=0; i< _bindingTemplates.length; i++) {
BindingTemplate bindingTemplate = _bindingTemplates[i];
BindingKey bindingKey = bindingTemplate.getBindingKey();
System.out.println("BindingKey #" + i + ": " + bindingKey);
}
|
|
(c) INSPIRE IT, 2003 | Send us your feedback: developers@ruddi.biz