| |

Lesson 4: Finding a tModel

Lesson objective

The objective of this lesson is to learn how to find tModel information in an UDDI registry.

Reference material

Source code of reference: FindTModelExample.java.

Releated 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 find information from an UDDI registry. Among them, the find_tModel message studied in this lesson allows finding technical model information. The UDDI registry reply is a tModelList message. More detailed information on a technical model can then be obtained, if needed, using the get_tModelDetail call.

Code snippets

We first create an UDDIProfile and set, in this example, the inquiry 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.inquiry.url","http://uddi.microsoft.com/inquire");

profile.setProperty("inspireit.uddi.version","2.0");

An UDDIQuerier to query the UDDI registry can be instantiated using the static getQuerier(UDDIProfile) method:

UDDIQuerier querier = UDDIQuerier.getQuerier(profile);

UDDIQuerier comes with a set of methods to search high-level information on technical models stored in an UDDI registry. In this example, we are searching for the unspsc-org:unspsc technical model:

TModelList tModelList = querier.findTModel(new Name("unspsc-org:unspsc"));

The UDDIQuerier methods all throw RemoteException and UDDIException , not catched here for clarity. The returned TModelList can be further decomposed at the required level of granularity.

TModelInfos tModelInfos = tModelList.getTModelInfos();

TModelInfo _tModelInfos[] = tModelInfo.toArray();

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

TModelInfo tModelInfo = _tModelInfos[i];

System.out.println("TModelInfo #" + i + ": " + tModelInfo.getName());
}

 

| |

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