Publishing a Business Entity
Before its services can be published, Prudentially 401(k), Inc. needs to register its business entity with the UDDI registry. This registered entity assumes ownership of the services registered thereafter. Service consumers who discover services applicable to their needs can then search for the responsible entity to get more information about the service provider.
In C#, the main class that drives the registration of the business entity is SaveBusiness. This class acts as the container that holds the information necessary to register the business. The code segment below can be used to populate business entities for Prudentially 401(k), Inc.
SaveBusiness sb = new SaveBusiness(); // Add business information sb.BusinessEntities.Add(); sb.BusinessEntities.Names.Add("en", "Prudentially401k, Inc."); sb.BusinessEntities.Descriptions.Add ("en", "Prudentially401k, Inc. is known for outstanding service to its customers for their 401(k) needs."); sb.BusinessEntities.DiscoveryUrls.Add (http://www.tasmanave.com/Prudentially401k, "http"); //Add contact Contact c = new Contact("John Doe", "Contact"); c.Phones.Add("111-222-3333", ""); sb.BusinessEntities.Contacts.Add(c);
For the human-readable description associated with any attribute, such as the business entity description above, the UDDI specification allows one description per language code. The applicable language codes are defined by the Internet Engineering Task Force (IETF) standard known as Request For Comment (RFC) 1766.
Classifying a Business Entity
At the time of registration, a business entity should also be categorized properly so that it can be discovered by appropriate clientele, although this is not mandated by the UDDI specification. Prudentially 401(k), Inc. needs to classify itself under the NAICS taxonomy and the Pension Fund classification code, 524292, because of the FITSO specification. For each classification, three data elements are required:
tModel key associated with the classification scheme
key name under which the entity is classified
value or code associated with the key
A class keyedReference holds these three elements together:
//Add taxonomy tModel KeyedReference kr = new KeyedReference(); //Use UDDI-defined tModel key for NAICS kr.TModelKey = "uuid:C0B9FE13-179F-413D-8A5B-5004DB8E5BB2"; kr.KeyName = "Pension fund, third-party administrative services"; kr.KeyValue = "524292"; sb.BusinessEntities.CategoryBag.Add(kr);
Although not used in this example, a business entity should also specify the set of identifiers, such as DUNS identifiers, that can uniquely identify the entity. Even though providing these identifiers is optional, they help in precision of a discovered entity. Like the classification scheme, the UDDI specification does not mandate any identification scheme.
Once the SaveBusiness container object is ready with all the necessary information, the entity can be registered using the Send method:
BusinessDetail bd = sb.Send();
The returned BusinessDetail object can be used to get the UUID key assigned to the registered resource.
Publishing a tModel
Recall that FITSO developed a service interaction specification, TM401k, for the pension fund 401(k) information services. This interaction specification needs to be registered in UDDI as a tModel.
In the UDDI .NET SDK, the main class to use for tModel registration is SaveTModel. This class is used for registering (and modifying) a tModel. As with the business entity class, the tModel object model needs to be populated before being saved in the UDDI registry:
SaveTModel stm = new SaveTModel(); stm.TModels.Add(); stm.TModels.Name = "TM401k"; stm.TModels.Descriptions.Add ("en", "tModel defined by FITSO for 401(k) interactions"); stm.TModels.OverviewDoc.OverviewURL = "http://www.tasmanAve.com/FITSO/TM401k.wsdl"; //Add category bag conditionally stm.TModels.CategoryBag.Add(); //Use built-in uddi-org:general_keywords tModel UUID //to classify this tModel stm.TModels.CategoryBag.TModelKey = "uuid:A035A07C-F362-44dd-8F95-E2B134BF43B4"; stm.TModels.CategoryBag.KeyName = "KEYWORD"; stm.TModels.CategoryBag.KeyValue = "401(k)"; TModelDetail tmd = stm.Send();
The data elements associated with tModel registration are similar to those of a business entity registrationname, description, category, and so on. The UDDI registry provides a unique UUID key for the tModel registration. The tModel can then be identified using this key.
Publishing a Service
Following a similar pattern, the main API for publishing a service to the UDDI registry is SaveService using the UDDI .NET SDK. Using the SaveService class methods, the service object needs to be populated with the service details. One additional service detail to note is the field BusinessKey, which links the service to the responsible or publishing business entity. In this case, we link the P401Kservice to the Prudentially401(k), Inc. business entity. The BusinessKey returned when the business entity was registered should be stored:
SaveService ss = new SaveService(); ss.BusinessServices.Add(); ss.BusinessServices.Names.Add("en", P401kService); ss.BusinessServices.Descriptions.Add ("en", "401(k) management service by Prudentially401(k), Inc. abiding by the FITSO TM401k tModel"); ss.BusinessServices.BusinessKey = "business key from SaveBusiness call";
In addition to this information, the service binding information must also be provided. This binding information includes data about a specific instance of the service such as service access point and the tModel with which the service complies:
BindingTemplate bt = new BindingTemplate(); bt.AccessPoint = new AccessPoint(Microsoft.Uddi.Api.URLType.Http, "service access point"); TModelInstanceInfo tmii = new TModelInstanceInfo(); tmii.TModelKey = "TM401k registration key"; bt.TModelInstanceDetail.TModelInstanceInfos.Add(tmii); ss.BusinessServices.BindingTemplates.Add(bt);
A service must also be classified, like other resources such as business entities and tModels. This process is similar to one discussed earlier in the article.