| |

Lesson 13: Deleting a tModel

Lesson objective

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

Reference material

Source code of reference: DeleteTModelExample.java

Related lessons

Lesson 9, "Saving a tModel", can be completed before this lesson to save a sample tModel 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_tModel message studied in this lesson allows deleting a technical model. 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 technical model, we use one of the available deleteTModel() methods. For example:

TModelKey tModelKey = ... // the technical model key of the technical model to delete

DispositionReport dispositionReport = publisher.deleteTModel(tModelKey);

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("Technical model successfully deleted");

} else {

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

}

}

| |

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