| |

Lesson 9: Saving a tModel

Lesson objective

The objective of this lesson is to learn how to save a technical model in a UDDI registry.

Reference material

Source code of reference: SaveTModelExample.java

Related lessons

This lesson can be completed with lesson 13, "Deleting a TModel".

Review of concepts

The UDDI Programmer's API defines the messages to be used to save information in an UDDI registry. Among them, the save_tModel message studied in this lesson allows saving technical model information. The UDDI registry reply is a tModelDetail message returning the technical model information as it has been saved in the UDDI registry.

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 publish information to UDDI registries. To publish technical model, we use one of the available saveTModel() methods. For example:

TModel tModel = ... // the binding template to publish

TModelDetail tModelDetail = publisher.saveTModel(tModel);

The UDDIPublisher methods all throw RemoteException and UDDIException , not catched here for clarity. The returned TModelDetail provides a complete view on the way the technical model (or technical models) has (or have) been saved, such as the technical model key(s) that has (or have) been computed to uniquely tag the information in the UDDI registry.

The following code shows how the returned TModelDetail can be decomposed at the level of granularity required to access the technical model key information:

TModels tModels = tModelDetail.getTModels();

TModel _tModels[] = tModels.toArray();

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

TModel tModel = _tModels[i];

TModelKey tModelKey = tModel.getTModelKey();

System.out.println("TModelKey #" + i + ": " + tModelKey);
}

 

| |

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