| |

Lesson 12: Deleting a binding

Lesson objective

The objective of this lesson is to learn how to delete a binding template from an UDDI registry.

Reference material

Source code of reference: DeleteBindingExample.java

Related lessons

Lesson 8, "Saving a binding", can be completed before this lesson to save a sample bindingTemplate to be deleted.

Review of concepts

The UDDI Programmer's API defines the messages to be used to delete information from an UDDI registry. Among them, the delete_binding message studied in this lesson allows deleting a binding template. The UDDI registry reply is a dispositionReport message that provides status on the success of the deletion.

Code snippets

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 delete information from UDDI registries. To delete a binding template, we use one of the available deleteBinding() methods. For example:

BindingKey bindingKey = ... // the binding key of the binding template to delete

DispositionReport dispositionReport = publisher.deleteBinding(bindingKey);

The UDDIPublisher methods all throw RemoteException and UDDIException , not catched here for clarity. The returned DispositionReport provides information on the status of the deletion:

Results results = dispositionReport.getResults();

Result _results[] = results.toArray();

for(int i=0; i< _results.length; i++) {

Result result = _results[i];

if (result.getErrNo() == Result.E_success) {

System.out.println("Binding template successfully deleted");

} else {

System.out.println("Error:" + result.getErrInfo());

}

}

| |

(c) INSPIRE IT, 2003 | Send us your feedback: developers@ruddi.biz