Moving on, I had a registered service and wanted to add some data to it. This add on data is expressed as tModels in UDDI. tModels are nothing more than a key, name, value tuple. The catch with UDDI is that all tModel keys need to be registered before they can be used. I was discovered is that registering a new tModel isn't as straight forward as I thought it would be. The rest of the post is a how-to guide for creating new tModels in UDDI by first creating a tModel Generator. A tModel Generator is also known as a tModel Key Partition in jUDDI.
From first hand experience, this process is identical for most of the UDDI services that exist, both commercial and open source.
1) Identify a domain that the tModels are related to. Such as a www.mycompany.com. This will become a "partition" in jUDDI. If you reference the UDDI spec, this is actually called a "keyGenerator"
2) Using the Publishing web service to call "save_tModel" with at minimum the following items defined.
tModelKey = uddi:www.mycompany.org:keyGene
- Name, such as My Company's Keymodel generator
- A KeyedReference tModel in the categoryBag with the following defined: ModelKey="uddi:uddi.org:categ
orization:types" - keyName="uddi-org:
keyGenerator" keyValue="keyGenerator" - An authentication token ( see the Security API)
SaveTModel st = new SaveTModel();
st.setAuthInfo(key);
TModel tm = new TModel();
tm.setName(new Name());
tm.getName().setValue("My Company's Keymodel generator");
tm.getName().setLang("en");
tm.setCategoryBag(new CategoryBag());
KeyedReference kr = new KeyedReference();
kr.setTModelKey("uddi:uddi.org:categorization:types");
kr.setKeyName("uddi-org:keyGenerator");
kr.setKeyValue("keyGenerator");
tm.getCategoryBag().getKeyedReference().add(kr);
tm.setTModelKey("uddi:www.mycoolcompany.com:keygenerator");
st.getTModel().add(tm);
3) Send in the request.
TModelDetail saveTModel = publish.saveTModel(st);
System.out.println("Creation of Partition Success!");
4) You may now create tModels with keys start with "uddi:www.mycompany.com:" such as uddi:www.mycompany.com:somecus tomkey
tm = new TModel();
tm.setName(new Name());
tm.getName().setValue("My Company's Department");
tm.getName().setLang("en");
tm.setTModelKey("uddi:www.mycoolcompany.com:department");
st.getTModel().add(tm);
saveTModel = publish.saveTModel(st);
System.out.println("Creation of tModel Department Success!");
tm = new TModel();
tm.setName(new Name());
tm.getName().setValue("My Company's Authentication Method");
tm.getName().setLang("en");
tm.setTModelKey("uddi:www.mycoolcompany.com:authmode");
st.getTModel().add(tm);
saveTModel = publish.saveTModel(st);
System.out.println("Creation of tModel Auth Mode Success!");
Note: tModel keys, at least in jUDDI, converted to all lower case. Some implementations support mixed case, but to be safe, always use lower case.
No comments:
Post a Comment