The objective of this lesson is to learn how to delete a business from a UDDI registry.
Lesson 6, "Saving a business", can be completed before this lesson to save a sample businessEntity to be deleted.
The UDDI Programmer's API defines the messages to be used to delete information from an UDDI registry. Among them, the delete_business message studied in this lesson allows deleting a business entity. The UDDI registry reply is a dispositionReport message that provides status on the success of the deletion.
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 business entity, we use one of the available deleteBusiness() methods. For example:
BusinessKey businessKey = ... // the business key of the business entity to delete
DispositionReport dispositionReport = publisher.deleteBusiness(businessKey);
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++) {
if (result.getErrNo() == Result.E_success) {
System.out.println("Business successfully deleted");
|
|
(c) INSPIRE IT, 2003 | Send us your feedback: developers@ruddi.biz