Key Components of UDDI

Key Components of UDDI

UDDI (Universal Description, Discovery, and Integration) is a platform-independent, XML-based registry for businesses worldwide to list themselves on the internet. It serves as a directory service where web services can be registered and discovered. UDDI allows businesses to publish information about their services, including what services are available, how to invoke them, and where they are located.

Key Components of UDDI

Key Components of UDDI:

  • 1.  Business Information : Contains general information about the business, such as the name, description, and contact details.
  • 2.  Service Information : Provides detailed information about the web services offered by the business, including service descriptions, bindings, and references to WSDL documents.
  • 3.  Binding Templates : Define the technical details of how to access the web services, including URLs and communication protocols. 4.  TModels : Represent technical models that describe various aspects of the web service, such as interfaces and security policies.

Explanation in Java Example

To illustrate how UDDI works in Java, we’ll use the JAXR (Java API for XML Registries) to interact with a UDDI registry. JAXR provides a standard API for accessing different types of XML registries, including UDDI.

1. Publishing a Service to UDDI
java
import javax.xml.registry.*;
import javax.xml.registry.infomodel.*;

public class UDDIPublish {
    public static void main(String[] args) {
        try {
            // Create connection to registry
            ConnectionFactory factory = ConnectionFactory.newInstance();
            factory.setProperty("javax.xml.registry.queryManagerURL", "http://localhost:8080/juddi/inquiry");
            factory.setProperty("javax.xml.registry.lifeCycleManagerURL", "http://localhost:8080/juddi/publish");
            Connection connection = factory.createConnection();
            
            // Get registry service and life cycle manager
            RegistryService rs = connection.getRegistryService();
            BusinessLifeCycleManager blcm = rs.getBusinessLifeCycleManager();
            
            // Create and save business entity
            BusinessEntity businessEntity = blcm.createBusinessEntity("My Business");
            businessEntity.setDescription(blcm.createInternationalString("Description of my business"));
            blcm.saveBusinessEntities(java.util.Collections.singletonList(businessEntity));
            
            System.out.println("Business published successfully!");
        } catch (JAXRException e) {
            e.printStackTrace();
        }
    }
}

2. Querying a Service from UDDI
java
import javax.xml.registry.*;
import javax.xml.registry.infomodel.*;

public class UDDIQuery {
    public static void main(String[] args) {
        try {
            // Create connection to registry
            ConnectionFactory factory = ConnectionFactory.newInstance();
            factory.setProperty("javax.xml.registry.queryManagerURL", "http://localhost:8080/juddi/inquiry");
            Connection connection = factory.createConnection();
            
            // Get registry service and query manager
            RegistryService rs = connection.getRegistryService();
            BusinessQueryManager bqm = rs.getBusinessQueryManager();
            
            // Find businesses
            BulkResponse response = bqm.findOrganizations(null, null, null, null, null, null);
            for (Object obj : response.getCollection()) {
                Organization org = (Organization) obj;
                System.out.println("Found business: " + org.getName().getValue());
                System.out.println("Description: " + org.getDescription().getValue());
            }
        } catch (JAXRException e) {
            e.printStackTrace();
        }
    }
}

Explanation

  • 1.  Publishing a Service :
    • We first establish a connection to the UDDI registry using ConnectionFactory.
    • We then obtain the RegistryService and BusinessLifeCycleManager.
    • We create a new BusinessEntity, set its name and description, and save it to the registry.
  • 2.  Querying a Service :
    • We establish a connection to the UDDI registry using ConnectionFactory.
    • We obtain the RegistryService and BusinessQueryManager.
    • We query the registry for available businesses and print their details.