Universal Description, Discovery, and Integration (UDDI) is a platform-independent framework that was developed as part of the web services initiative. It enables businesses to publish, find, and interact with each other using web services. UDDI serves as a directory for web services, much like a phone book, allowing service providers to register their services and consumers to find and bind to those services.
Key Components of UDDI
- BusinessEntity: Represents the business or organization providing web services.
- BusinessService: Represents the services offered by the business.
- BindingTemplate: Provides technical details about how and where to access a service.
- tModel (Technical Model): A template for a reusable description of a web service, which may include technical specifications.
UDDI Structure
The UDDI structure consists of several core components that work together to provide a complete description of a web service:
- White Pages: Contains basic information about the business, such as name, address, and contact information.
- Yellow Pages: Categorizes businesses based on standard taxonomies, making it easier to find them.
- Green Pages: Contains technical information about the services, including the web service’s binding information (i.e., where and how to access it).
UDDI Registry Operations
UDDI defines a set of operations for interacting with the UDDI registry. These operations are typically performed using SOAP (Simple Object Access Protocol). Here are some common operations:
publish
: Used by service providers to register their business and services in the UDDI registry.find
: Used by service consumers to locate services based on various criteria.bind
: Used to retrieve the details necessary to invoke a service.inquire
: Used to perform inquiries on the UDDI registry, such as searching for services.
Example UDDI Use Case
Let’s consider a hypothetical company, “ExampleCorp,” that provides a weather forecasting service.
Step 1: Registering the Business Entity
First, “ExampleCorp” would register its business entity in the UDDI registry.
<BusinessEntity xmlns="urn:uddi-org:api_v2">
<Name>ExampleCorp</Name>
<Description>Provider of weather forecasting services</Description>
<Contacts>
<Contact>
<PersonName>John Doe</PersonName>
<Email>johndoe@examplecorp.com</Email>
<Phone>+1234567890</Phone>
</Contact>
</Contacts>
</BusinessEntity>
Step 2: Registering the Web Service
Next, “ExampleCorp” would register its weather forecasting service under the business entity.
<BusinessService xmlns="urn:uddi-org:api_v2">
<Name>WeatherForecastService</Name>
<Description>Provides weather forecasts based on geographic location</Description>
<BindingTemplates>
<BindingTemplate>
<AccessPoint URLType="http">http://examplecorp.com/weatherforecast</AccessPoint>
</BindingTemplate>
</BindingTemplates>
</BusinessService>
Step 3: Defining the Technical Model (tModel)
A tModel is used to describe the technical details of the service, such as the WSDL (Web Services Description Language) document that defines the service’s operations.
<tModel xmlns="urn:uddi-org:api_v2">
<Name>WeatherForecastService tModel</Name>
<Description>Technical model for the Weather Forecast Service</Description>
<OverviewDoc>
<OverviewURL>http://examplecorp.com/weatherforecast?wsdl</OverviewURL>
</OverviewDoc>
</tModel>
Step 4: Searching for the Service
A potential client can search for “ExampleCorp” or the “WeatherForecastService” using the find
operation.
<find_service xmlns="urn:uddi-org:api_v2">
<Name>WeatherForecastService</Name>
</find_service>
The UDDI registry will return the details of the service, including the access point URL.
Step 5: Binding to the Service
Once the client has found the service, they can retrieve the binding information to invoke the service.
<BindingTemplate xmlns="urn:uddi-org:api_v2">
<AccessPoint URLType="http">http://examplecorp.com/weatherforecast</AccessPoint>
</BindingTemplate>
Code Example: Interacting with UDDI Using Java
Let’s look at a simple Java example to interact with a UDDI registry using the Apache JUDDI (a popular UDDI implementation).
import org.apache.juddi.v3.client.transport.Transport;
import org.uddi.api_v3.BusinessEntity;
import org.uddi.api_v3.BusinessInfo;
import org.uddi.api_v3.BusinessList;
import org.uddi.api_v3.BusinessService;
import org.uddi.api_v3.ServiceDetail;
import org.uddi.api_v3.TModel;
import org.uddi.api_v3.TModelDetail;
import org.uddi.v3_service.UDDIInquiryPortType;
import org.uddi.v3_service.UDDIPublicationPortType;
public class UDDIExample {
public static void main(String[] args) {
try {
// Initialize transport
Transport transport = new Transport();
UDDIPublicationPortType publish = transport.getUDDIPublishService();
UDDIInquiryPortType inquiry = transport.getUDDIInquiryService();
// Register Business Entity
BusinessEntity businessEntity = new BusinessEntity();
businessEntity.setName("ExampleCorp");
publish.saveBusiness(businessEntity);
// Register Web Service
BusinessService service = new BusinessService();
service.setName("WeatherForecastService");
publish.saveService(service);
// Define tModel
TModel tModel = new TModel();
tModel.setName("WeatherForecastService tModel");
publish.saveTModel(tModel);
// Search for the Service
BusinessList businessList = inquiry.findBusiness("ExampleCorp");
for (BusinessInfo businessInfo : businessList.getBusinessInfos().getBusinessInfo()) {
System.out.println("Business: " + businessInfo.getName());
}
// Get Service Details
ServiceDetail serviceDetail = inquiry.getServiceDetail("WeatherForecastService");
System.out.println("Service URL: " + serviceDetail.getBindingTemplate().get(0).getAccessPoint());
} catch (Exception e) {
e.printStackTrace();
}
}
}
Conclusion
UDDI plays a crucial role in the world of web services by providing a standardized way for businesses to publish, discover, and integrate services. Although its use has declined with the rise of RESTful services and modern APIs, understanding UDDI remains important for understanding the evolution of web service technologies.