Introduction:
UDDI (Universal Description, Discovery and Integration) is regarded as an important web services standard and a key component of Service-Oriented Architecture. UDDI’s role is not limited to providing a platform-independent framework for discovery of web services and enabling the consumer to access the service, but it has gone beyond that to provide SOA governance, impose various policies, promote best practices and ensure reduced integration costs and complexities.
UDDI is usually seen as a combination Business Service Registry and Business Service Repository. While a Business Service Registry alone is regarded as UDDI in most of the cases, a Business Service Repository is of paramount important to develop a full-fledged UDDI. It sometimes becomes necessary to store information artifacts like WSDL, XML, XSD etc. and repositories are employed to serve this purpose. UDDIs are generally classified as public and private but to attract more customers and to provide a wide range of services, federal registry is the right choice for most of the organization.
A lot of frameworks have been developed to provide APIs to access the registries regardless of the fact which registry is used. Some of the popular Java Client API providers are JAXR, Systinet, Apache Scout and jUDDI. It makes sense to decide which version of UDDI and what capability levels these APIs support. It is always preferred to use the one like systinet and JAXR, which has support for UDDI v3 (click here for features of v3) and capability level 0 and 1. Click Here for complete UDDI specification.
Apache Scout is new in the list and has support for capability level 0. Let’s discuss some of the API implementation or client-side development using Apache Scout.
Apache Scout APIs can be found at the following location:
http://ws.apache.org/scout/apidocs/index.html
Getting Started:
Before getting started with the development, it is imperative to understand how resources are mapped in the UDDI architecture. The specification also describes how information is represented within UDDI using data structure types.
The UDDI API set can be divided into two parts viz. Inquiry and Pulication. The Inquiry API set is used to locate and obtain information and details on entries in the registry whereas the Publication API set is use to publish and update information in the registry.
Get API Endpoints:
The URLs are used to obtain full standard UDDI v3 structures.
public static final String InquiryUrl = “http://://uddi/inquiry";
public static final String SecurityUrl = “http://://uddi/security";
public static final String PublishUrl = “http://://uddi/publish";
Finding Business
It is possible to find business using various search principles. User can use these search principles to apply filter while making inquiry calls.
FindBusinessDocument doc = FindBusinessDocument.Factory.newInstance();
FindBusiness find_biz = doc.addNewFindBusiness();
//Collecting Inquiry Parameters for Business
find_biz.setNameArray(nameArray);
find_biz.setDiscoveryURLs(discoveryURLs);
find_biz.setIdentifierBag(identifierBag);
find_biz.setCategoryBag(categoryBag);
find_biz.setTModelBag(tModelBag);
find_biz.setFindQualifiers(findQualifiers);
find_biz.setMaxRows(maxRows);
BusinessList businessList;
XmlObject xmlObj = execute(doc, new URI(InquiryUrl)).changeType(BusinessListDocument.type);
//Retrieving the business list
businessList = ((BusinessListDocument) xmlOb).getBusinessList();
The execute() function signature has been changed slightly from the jUDDI version, since the URL can no longer be decided dynamically (in an easy enough manner) as we don't use jUDDI data types anymore.
Finding Binding
A binding template represents the technical details of how to invoke its service. A business service can contain one or more binding templates. A service key can be used as a primary key to fing binding templates associated with a service.
FindBindingDocument doc = FindBindingDocument.Factory.newInstance();
FindBinding find_bind = doc.addNewFindBinding();
//Collecting Inquiry Parameters for Binding
find_bind.setServiceKey(serviceKey);
find_bind.setTModelBag(tModelBag);
find_bind.setFindQualifiers(findQualifiers);
find_bind.setMaxRows(maxRows);
BindingDetail bindingDetail;
XmlObject xmlObj = execute(doc, new URI(InquiryUrl)).changeType(
BindingDetailDocument.type);
//Retrieving the binding details
bindingDetail = ((BindingDetailDocument) xmlObj).getBindingDetail();
Finding Service
The UDDI registry stores data and metadata about business services. The following code snippet is used to find a business service registered in UDDI.
FindServiceDocument doc = FindServiceDocument.Factory.newInstance();
FindService find_serv = doc.addNewFindService();
//Collecting Inquiry Parameters for Service
find_serv.setBusinessKey(businessKey);
find_serv.setNameArray(nameArray);
find_serv.setCategoryBag(categoryBag);
find_serv.setTModelBag(tModelBag);
find_serv.setFindQualifiers(findQualifiers);
find_serv.setMaxRows(maxRows);
ServiceList serviceList;
XmlObject xmlObj = execute(doc, new URI(InquiryUrl)).changeType(
ServiceListDocument.type);
//Retrieving the service details
serviceList = ((ServiceListDocument) xmlObj).getServiceList();
Finding tModel
A UDDI registry offers a standards-based mechanism to classify, catalog and manage Web services so that they can be discovered and consumed by other applications. The tModel provides a reference to an abstraction describing compliance with a specification and concepts. The following code snippet lets a user to find tModels.
FindTModelDocument doc = FindTModelDocument.Factory.newInstance();
FindTModel find_tmod = doc.addNewFindTModel();
Name n = Name.Factory.newInstance();
n.setStringValue(name);
//Collecting Inquiry Parameters for tModel
find_tmod.setName(n);
find_tmod.setCategoryBag(categoryBag);
find_tmod.setIdentifierBag(identifierBag);
find_tmod.setFindQualifiers(findQualifiers);
find_tmod.setMaxRows(maxRows);
TModelList tModelList;
XmlObject xmlObj = execute(doc, new URI(InquiryUrl)).changeType(
TModelListDocument.type);
//Retrieving the tModel details
tModelList = ((TModelListDocument) xmlObj).getTModelList();
The tModel can be associated with an arbitrary number of identifiers that uniquely identify it. CategoryBags is used because tModels can be categorized like all other UDDI entities.
Getting Assertion Status Report
This operation provides administrative support for determining the status of current and outstanding publisher assertions that involve any of the business registrations managed by the individual publisher account. Using this message, a publisher can see the status of assertions that they have made, as well as see assertions that others have made that involve businessEntity structures controlled by the calling publisher account.
The following lines of code will set the “completionStatus” element.
GetAssertionStatusReportDocument doc = GetAssertionStatusReportDocument.Factory
.newInstance();
GetAssertionStatusReport get_assert = doc.addNewGetAssertionStatusReport();
//Get Authentication token to provide security credentials
get_assert.setAuthInfo(authInfo);
get_assert.setCompletionStatus(completionStatus);
AssertionStatusReport asr;
XmlObject xmlObj = execute(doc, this.getPublishURI()).changeType(
AssertionStatusReportDocument.type);
asr = ((AssertionStatusReportDocument) xmlObj).getAssertionStatusReport();
Establishing Authentication
Authorization token is obtained in the following code snippet to be used for each operation on the publishing port.
GetAuthTokenDocument doc = GetAuthTokenDocument.Factory.newInstance();
GetAuthToken get_auth = doc.addNewGetAuthToken();
get_auth.setUserID(userID);
get_auth.setCred(cred);
AuthToken at;
XmlObject xmlObj = execute(doc, new URI(PublishUrl)).changeType(
AuthTokenDocument.type);
at = ((AuthTokenDocument) xmlObj).getAuthToken();
Getting Business Details
The following lines of code allow a user to retrieve information about a business that publishes the service.
String[] keys = new String[1];
keys[0] = businessKey;
GetBusinessDetailDocument doc = GetBusinessDetailDocument.Factory
.newInstance();
GetBusinessDetail get_biz = doc.addNewGetBusinessDetail();
get_biz.setBusinessKeyArray(keys);
BusinessDetail bd;
XmlObject xmlObj = execute(doc, new URI(InquiryUrl)).changeType(
BusinessDetailDocument.type);
bd = ((BusinessDetailDocument) xmlObj).getBusinessDetail();
Set the businessKey of the businessEntity to be fetched, get an inquiry url and perform a getBusinessDetail() call to obtain the results.
Getting Publisher Assertion
It is possible to assert relationship between business entities.
The following lines of code can be used to obtain the full set of publisher assertions that is associated with an individual publisher account.
GetPublisherAssertionsDocument doc = GetPublisherAssertionsDocument.Factory
.newInstance();
GetPublisherAssertions get_pubassert = doc.addNewGetPublisherAssertions();
get_pubassert.setAuthInfo(authInfo);
PublisherAssertions pa;
XmlObject xmlObj = execute(doc, new URI(PublishUrl)).changeType(
PublisherAssertionsDocument.type);
pa = ((PublisherAssertionsDocument) xmlObj).getPublisherAssertions();
Getting Service Details
The following lines of code allow a user to retrieve information about a service.
String[] keys = new String[1];
keys[0] = serviceKey;
GetServiceDetailDocument doc = GetServiceDetailDocument.Factory
.newInstance();
GetServiceDetail get_servdet = doc.addNewGetServiceDetail();
get_servdet.setServiceKeyArray(keys);
ServiceDetail sd;
XmlObject xmlObj = execute(doc, new URI(InquiryUrl)).changeType(
ServiceDetailDocument.type);
sd = ((ServiceDetailDocument) xmlObj).getServiceDetail();
Set the serviceKey of the business service to be fetched, get an inquiry url and perform a getServiceDetail() call to obtain the results.
Getting tModel Details
The following lines of code allow a user to retrieve information about a tModel.
String[] keys = new String[1];
keys[0] = tModelKey;
GetTModelDetailDocument doc = GetTModelDetailDocument.Factory
.newInstance();
GetTModelDetail get_tmoddet = doc.addNewGetTModelDetail();
get_tmoddet.setTModelKeyArray(keys);
TModelDetail tmd;
XmlObject