← Back to list

Build a Simple UDDI Registry in Java

Demonstration of Publish-Find-Bind cycle using IntelliJ IDEA

OpenShantanu · 2026-07-22 04:40 · 0 claps · 6.5 min read
#uddi #java #intellij-idea #web-services
Open on Medium ↗

Build a Simple UDDI Registry in Java

Demonstration of Publish-Find-Bind cycle using IntelliJ IDEA

Photo by Markus Spiske on Unsplash

Photo by Markus Spiske on Unsplash

Introduction

Before REST APIs and microservices became the dominant way to build distributed systems, Service-Oriented Architecture (SOA) relied heavily on web services. As organizations created hundreds of SOAP-based services, one important question emerged:

How do applications discover available web services?

The answer was UDDI (Universal Description, Discovery, and Integration).

Think of UDDI as a phone directory for web services. Instead of storing people’s phone numbers, it stores information about businesses, the services they provide, and where those services can be accessed.

In this guide, we’ll build a simple UDDI registry simulation in Java using IntelliJ IDEA. While this is not a full enterprise UDDI server, it demonstrates the core concepts behind service registration and discovery in a clean and beginner-friendly way.

What You’ll Build

By the end of this guide, you’ll have a console application capable of:

  • Registering a web service
  • Searching for a registered service
  • Displaying all available services

Although simplified, these operations mirror the fundamental responsibilities of a UDDI registry.

Prerequisites

Before getting started, make sure you have:

  • IntelliJ IDEA Community or Ultimate Edition
  • JDK 17 or later (JDK 11 also works)
  • Basic understanding of Java classes and collections

No external libraries or frameworks are required.

Understanding the UDDI Concept

Imagine you’re looking for a nearby hospital.

You don’t already know the hospital’s phone number or address — you search a directory that provides:

  • Hospital name
  • Services offered
  • Contact information
  • Location

A UDDI registry serves a similar purpose for software systems.

Instead of hospitals, it stores businesses.

Instead of contact numbers, it stores web service endpoints.

Instead of addresses, it stores service URLs.

Applications query this registry whenever they need to locate a specific service.

Project Structure

Create a new Java project in IntelliJ IDEA with the following structure:

UDDIRegistryDemo
│
├── src
│   ├── ServiceInfo.java
│   ├── UDDIRegistry.java
│   └── Main.java

Each file has a specific responsibility.

ServiceInfo.java

Represents a single web service.

It stores:

  • Business name
  • Service name
  • Service URL

This is essentially the information that would normally be published to a registry.

Code

public class ServiceInfo {
  private String serviceName;
  private String businessName;
  private String serviceURL;
  public ServiceInfo(String serviceName, String businessName, String serviceURL) {
      this.serviceName = serviceName;
      this.businessName = businessName;
      this.serviceURL = serviceURL;
  }
  public String getServiceName() {
      return serviceName;
  }
  public String getBusinessName() {
      return businessName;
  }
  public String getServiceURL() {
      return serviceURL;
  }
  @Override
  public String toString() {
      return "Business Name : " + businessName +
              "\nService Name  : " + serviceName +
              "\nService URL   : " + serviceURL;
  }
}

Explanation

This class acts as a model (or data object) that represents a single web service registered in the UDDI registry. Every object of ServiceInfo contains three pieces of information:

  • Business Name — The organization that owns the service.
  • Service Name — The name used to identify the web service.
  • Service URL — The endpoint where the service can be accessed.

The constructor initializes these values when a new service is created. Getter methods allow other classes to retrieve the information, while the overridden toString() method formats the service details into a readable output whenever the object is printed.

UDDIRegistry.java

This class behaves like a miniature UDDI server.

Internally, it stores registered services using an ArrayList.

It provides three operations:

  • Register a service
  • Search for a service
  • Display all services

In enterprise systems, this information would typically be stored in a relational database and accessed through SOAP APIs.

Code

import java.util.ArrayList;

public class UDDIRegistry {
    private ArrayList<ServiceInfo> services = new ArrayList<>();
    // Register a new service
    public void registerService(ServiceInfo service) {
        services.add(service);
        System.out.println("\nService Registered Successfully!");
    }
    // Search service by name
    public ServiceInfo findService(String serviceName) {
        for (ServiceInfo service : services) {
            if (service.getServiceName().equalsIgnoreCase(serviceName)) {
                return service;
            }
        }
        return null;
    }
    // Display all registered services
    public void displayServices() {
        if (services.isEmpty()) {
            System.out.println("No Services Registered.");
            return;
        }
        System.out.println("\n===== Registered Services =====");
        for (ServiceInfo service : services) {
            System.out.println("-------------------------------");
            System.out.println(service);
        }
    }
}

Explanation

The UDDIRegistry class simulates the behavior of a simple UDDI registry by maintaining a collection of registered services using Java's ArrayList.

It provides three important methods:

  • registerService() — Adds a new ServiceInfo object to the registry.
  • findService() — Iterates through the list and searches for a service based on its name. If found, the corresponding object is returned; otherwise, the method returns null.
  • displayServices() — Prints every registered service in the registry. If no services have been registered yet, an appropriate message is displayed.

In a real enterprise UDDI implementation, these operations would interact with a database and expose SOAP-based APIs for publishing and discovering services. Here, the ArrayList acts as an in-memory registry to keep the implementation simple.

Main.java

This class provides a console-based interface where users can:

  • Register services
  • Search services
  • Display all registered services

It ties together the registry and the service model into a complete application.

Code

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        UDDIRegistry registry = new UDDIRegistry();
        int choice;
        do {
            System.out.println("\n====== Simple UDDI Registry ======");
            System.out.println("1. Register Service");
            System.out.println("2. Search Service");
            System.out.println("3. Display All Services");
            System.out.println("4. Exit");
            System.out.print("Enter Choice : ");
            choice = sc.nextInt();
            sc.nextLine();
            switch (choice) {
                case 1:
                    System.out.print("Business Name : ");
                    String business = sc.nextLine();
                    System.out.print("Service Name : ");
                    String service = sc.nextLine();
                    System.out.print("Service URL : ");
                    String url = sc.nextLine();
                    registry.registerService(
                            new ServiceInfo(service, business, url));
                    break;
                case 2:
                    System.out.print("Enter Service Name : ");
                    String search = sc.nextLine();
                    ServiceInfo result = registry.findService(search);
                    if (result != null) {
                        System.out.println("\nService Found");
                        System.out.println(result);
                    } else {
                        System.out.println("Service Not Found");
                    }
                    break;
                case 3:
                    registry.displayServices();
                    break;
                case 4:
                    System.out.println("Thank You");
                    break;
                default:
                    System.out.println("Invalid Choice");
            }
        } while (choice != 4);
        sc.close();
    }
}

Explanation

The Main class is the entry point of the application and provides a menu-driven console interface that allows users to interact with the registry.

When the application starts, it creates:

  • A Scanner object to accept user input.
  • A UDDIRegistry object that stores all registered services.

The application repeatedly displays a menu until the user chooses to exit.

Each menu option performs a specific operation:

  • Register Service — Collects the business name, service name, and service URL from the user, creates a new ServiceInfo object, and registers it with the registry.
  • Search Service — Accepts a service name, searches the registry, and displays the service details if found.
  • Display All Services — Lists every registered service currently stored in memory.
  • Exit — Terminates the application gracefully.

This class demonstrates how multiple Java classes collaborate using object-oriented programming principles. Rather than storing all logic in one file, the application separates responsibilities into:

  • ServiceInfo for representing service data,
  • UDDIRegistry for managing the registry,
  • Main for interacting with the user.

This separation of concerns makes the application easier to understand, maintain, and extend in the future.

Running the Application

When executed, the application displays a simple menu.

1. Register Service
2. Search Service
3. Display All Services
4. Exit

Selecting Register Service prompts for:

  • Business Name
  • Service Name
  • Service URL

Example:

Business Name : Amazon
Service Name : ProductService
Service URL : http://localhost:8080/product

The registry stores these details in memory.

Searching for a Service

Once multiple services have been registered, users can search by service name.

For example:

Enter Service Name: ProductService

If the service exists, the registry displays:

Service found:
Business Name : Amazon
Service Name : ProductService
Service URL : http://localhost:8080/product

Otherwise, the application reports that the service could not be found.

Viewing All Registered Services

The third menu option lists every registered service.

Example output:

Business Name : Amazon
Service Name  : ProductService
Service URL   : http://localhost:8080/product

Business Name : Flipkart
Service Name  : OrderService
Service URL   : http://localhost:8080/order

This demonstrates how a registry maintains a centralized catalogue of available services.

How the Application Works

The application follows a simple workflow:

User
      │
      ▼
Console Menu
      │
      ▼
UDDI Registry
      │
      ▼
ArrayList<ServiceInfo>

Whenever a service is registered:

  • A new ServiceInfo object is created.
  • The object is stored in the registry.
  • The registry can later retrieve it during searches.

Although basic, this mirrors the publish-and-discover workflow found in enterprise service registries.

Why Use an ArrayList?

Enterprise registries store thousands of services inside databases.

For demonstration purposes, an ArrayList offers several advantages:

  • Easy to understand
  • No database configuration
  • Fast enough for small examples
  • Keeps the focus on the registry concept instead of persistence

Later, the same design can be extended to use MySQL, PostgreSQL, or another database.

Real-World Applications

Although dedicated UDDI registries are less common today, the underlying idea of service discovery is still widely used.

Modern technologies such as:

  • Kubernetes Service Discovery
  • Consul
  • Eureka
  • ZooKeeper
  • AWS Cloud Map

all solve the same fundamental problem:

“How can one application discover another without hardcoding its location?”

Whether you’re working with SOAP services, REST APIs, or cloud-native microservices, service discovery remains a key architectural principle.

Possible Enhancements

If you’d like to evolve this project further, consider adding:

  • Database storage (MySQL or PostgreSQL)
  • Update and delete operations
  • Search by business name
  • Search by URL
  • Export and import registry entries
  • REST or SOAP APIs for remote registration
  • Graphical user interface using JavaFX
  • Spring Boot backend
  • Persistent storage using JPA or Hibernate

These enhancements transform the project from a console demonstration into a more realistic service registry.

Key Takeaways

Building a simple UDDI registry is an excellent way to understand how service-oriented systems organize and discover web services.

In this project, you learned how to:

  • Represent service metadata using Java objects
  • Store registered services in a centralized registry
  • Search for services dynamically
  • Simulate the publish-and-discover workflow used in SOA

While today’s architectures often rely on REST, containers, and cloud-native service discovery mechanisms, the concepts introduced by UDDI continue to influence how distributed systems communicate. Understanding these foundations provides valuable context for modern application architecture and helps bridge the evolution from traditional SOA to today’s microservices ecosystems.


메타데이터
post_id
aa335876b7ec
slug
build-a-simple-uddi-registry-in-java-aa335876b7ec
url
https://medium.com/@openshantanu/build-a-simple-uddi-registry-in-java-aa335876b7ec
canonical_url
https://medium.com/@openshantanu/build-a-simple-uddi-registry-in-java-aa335876b7ec
author_url
https://medium.com/@openshantanu
status
ok
fetched_at
2026-07-25 13:37:49