The Inquiry Process
For an application to discover a particular service with minimal manual intervention, a structure must be in place that supports the path to the desired service. The classification and service interaction specifications provide just that structure. Business entities and services are classified within this framework (see Figure 2) and the inquiry process navigates this structure.
Figure 2 Inquiry structure in the UDDI registry.
The process of finding a service depends on the information available about the type or class of services to be discovered. The UDDI specification provides several APIs to discover various resources in the registry. This article focuses on the following types of queries:
Find service interface (tModel)
Find service
Find business entity
Usually, many details are published along with the main resource (whether a service, business entity, or a tModel). Quite a few of these details are searchable:
Name
Category key
Unique identifier key
Applicable tModel
Parent resource
A service consumer application can be designed to search on any number or combination of these types of details. However, the UDDI registry is designed for use in an ecosystem paradigm. Following is the typical scenario for which a service consumer application is designed:
Find all the relevant service interaction specifications.
Choose one that seems to meet your needs.
Find all the services that comply with that particular service interaction specification.
Choose the service that's most suitable.
Find the responsible business entities for the discovered services.
A service consumer may have an existing relationship with a service provider and want to search for all of its services. In this case, the inquiry process may simply include searching for all services provided by that business entity.
Let's consider an example. American Corporation, Inc. (ACI) is a company with a sizable workforce. Having recently decided to offer 401(k) plans to its employees, ACI researches the pension fund industry and comes to the conclusion that FITSO compliancy is an important criteria in selection; therefore, ACI has determined that it will work only with FITSO-compliant 401(k) service providers. The next three sections explain ACI's electronic inquiry process as supported by the UDDI registry.
Discovering a Service Interaction Specification
Figure 3 depicts a typical inquiry sequence for a service consumer. At the beginning of the inquiry process, the consumer usually knows only that the desired services abide by a certain interaction specification. In this example, ACI is looking for services that comply with the specification TM401k that FITSO published to the UDDI registry; this specification provides guidance on what features FITSO-compliant 401(k) service providers should include.
Figure 3 Ecosystem-based inquiry.
Remember that calls made to the inquiry URL are not secured because no authentication is required (especially in the case of the UBR used in these examples). The main configuration is simply denoting the inquiry URL with which the service consumer wants to communicate.
In UDDI4J, the class find_tModel is the starting point to find a tModel. find_tModel provides several methods to construct registry queries to search tModels. Queries can be designed to handle a broad-based search of interaction specifications and classification schemes, or a more refined search using more information about the interaction specification. In our example, the broader case simply uses a wildcard search to find particular characters in the name of the specification tModels published in the registry; the more refined search will be based on category.
Broad-Based Search
A broad-based search is not always sufficient. One of the goals of XML-based registries is to assist in the electronic decision-making process. Simply doing a wildcard search would require a manual selection after finding the interaction specifications. Given no other guidance, a manual decision process would be the only option. Entities such as consortiums and governing bodies should provide more details as to how to reach the exact interaction specification. Ideally, they would provide the following details:
Interaction specification name
Classification scheme and details
Refined Search
FITSO provides detailed interaction information in their specification. Using these guidelines, ACI can refine its search to locate interaction specifications with a specific name and classification type: The TM401k specification was published within the general_keyword taxonomy, with the keyword 401k. (Behind the scenes, a CategoryBag structure is constructed to store the additional information and prepare the appropriate inquiry XML to run on the UDDI registry.)
Using this additional information, the inquiry can be refined. Assume that the search parameters are stored in a file as follows:
#A partial name string to be used during search. #Note that % is used as a wildcard TMSearchName=%401%k% # Taxonomy to classify. # uddi-org:general_keywords CategoryTModelKey=uuid:A035A07C-F362-44dd-8F95-E2B134BF43B4 ClassificationName=KEYWORD ClassificationValue=401(k)
The search can then be conducted as follows:
//Find a taxonomy with specific keywords Properties TMp = new Properties(); TMp.load(new java.io.FileInputStream(args[0])); //Prepare the search parameters String searchName = TMp.getProperty("TMSearchName"); //Add category bag conditionally. Other parameters can be added // conditionally in a similar manner. CategoryBag cb = null; if(TMp.getProperty("CategoryTModelKey") != null); { cb = new CategoryBag(); cb.setKeyedReferenceVector(createCategoryVector(TMp)); } TModelList tl = proxy.find_tModel(searchName, cb, null, null, 5); Vector tminfv = tl.getTModelInfos().getTModelInfoVector();
Using the found tModel data, the following code segment uses the unique identifier and the class TModelInfos to display the description and overview documents associated with each tModel:
for(int i=0; i< tminfv.size(); i++) { TModelInfo tmi = (TModelInfo) tminfv.elementAt(i); System.out.println("tModel Name: " + tmi.getNameString()); System.out.println("tModel Key: " + tmi.getTModelKey()); TModelDetail tmd = proxy.get_tModelDetail(tmi.getTModelKey()); Vector tmv = tmd.getTModelVector(); //Get Description and overviewDoc for the tModel if(tmv.size()>0) { TModel tm = (TModel) tmv.elementAt(0); System.out.println("Default Description: " + tm.getDefaultDescriptionString()); System.out.println("Overview URL: " + tm.getOverviewDoc().getOverviewURLString()); }
Discovering a Service
After obtaining the appropriate tModel key for the service interface specification, ACI can find the services that comply with that specific tModel. For the sake of explanation, we'll call this the compliance tModel. In this example, the FITSO TM401(k) tModel is the compliance tModel.
Discovering a service is very similar to the process for discovering a tModel (or even a business). Constructing the search query is fairly similar to constructing the query for finding a tModel. Using the service name and the compliance tModel key, ACI can locate one or more of the services that comply with the FITSO tModel:
# A partial name string to be used during search. # Note that % is used as a wildcard ServiceSearchName=%401%k% # Compliance tModel Key ComplianceTModelKey=<Enter the key for your registered tModel>
And the code segment that accomplishes the search:
Properties Svcp = new Properties(); Svcp.load(new java.io.FileInputStream(args[0])); TModelBag tmb = new TModelBag(); tmb.setTModelKeyVector(createTModelVector(Svcp)); Vector names = new Vector(); names.add(new Name(Svcp.getProperty("ServiceSearchName"))); ServiceList sl = proxy.find_service(null, names, null, tmb, null, 5); Vector sinfv = sl.getServiceInfos().getServiceInfoVector();
TIP
I haven't constructed a query based on the CategoryBag structure as I did for tModels, but a similar approach is used. Queries based on categories would be useful if we were searching for a genre of services rather than a set of services that complied with a specific service interaction specification.
The results of the query return the service name as well as the service identification keys. These keys are useful because they provide direct access to the service for future use.
for(int i=0; i< sinfv.size(); i++) { ServiceInfo si = (ServiceInfo) sinfv.elementAt(i); System.out.println("Service Name: " + si.getNameString()); System.out.println("Service Key: " + si.getServiceKey()); BusinessDetail bd = proxy.get_businessDetail(si.getBusinessKey()); BusinessEntity be = (BusinessEntity) bd.getBusinessEntityVector().elementAt(0); System.out.println("Business Name: "+ be.getDefaultNameString()); }
Discovering a Business Entity
At this point, we've traversed a complete discovery pattern, where we discovered a tModel based on certain keywords, discovered a set of services that complied with the specific tModel, and obtained more information about the business entity that owned the service.
Another discovery pattern is also possible when a potential service user is aware of existing entities that might serve as business partners. In this situation, discovery would happen in reverse order: The business entity would be discovered first, followed by the services it offers.
Consider finding a business that satisfies the following search properties:
# NAICS (1997) TModelKey=uuid:C0B9FE13-179F-413D-8A5B-5004DB8E5BB2 ClassificationName=Pension fund, third party administrative services ClassificationValue=524292
For discovering a business entity, the find_business method of the UDDIProxy class acts as the central point where the search criteria are provided. In this example, it includes a taxonomy under which the business entity is classified:
//Select a business in a specific taxonomy Properties fbp = new Properties(); fbp.load(new java.io.FileInputStream(args[0])); CategoryBag cb = new CategoryBag(); cb.setKeyedReferenceVector(createCategoryVector(fbp)); //Search the business on the registry BusinessList bl = proxy.find_business(null, null, null, cb,null,null,5);
The class BusinessList gets detailed information about the chosen business entity:
//Print contact information for the found businesses Vector biv = bl.getBusinessInfos().getBusinessInfoVector(); for (int i = 0; i < biv.size(); i++) { BusinessInfo bi = (BusinessInfo)biv.elementAt(i); String key = bi.getBusinessKey(); Vector bdv = proxy.get_businessDetail(key).getBusinessEntityVector(); // Print name for each business System.out.println("Company: " + bi.getNameString()); if(bdv.size()>0) { BusinessEntity be = (BusinessEntity) bdv.elementAt(0); Vector cv = be.getContacts().getContactVector(); if(cv.size()>0) { Contact primeContact = (Contact)cv.elementAt(0); System.out.println("Primary contact: " primeContact.getPersonName().getText()); Vector phv = primeContact.getPhoneVector(); if(phv.size()>0) { Phone ph = (Phone) phv.elementAt(0); System.out.println("Phone: " + ph.getText()); } } } }
Search Qualifiers
The default behavior for inquiry APIsincluding those for finding businesses, services, and tModelsexecutes queries with a ANDed set of search criteria. However, this behavior can be modified using the optional element findQualifier. The UDDI V2 specification supports six built-in findQualifier values, which can be enhanced to support an even wider range of search qualifiers as needed for specialized environments. This is especially useful in a private registry deployment, where specialized searches might be desired.