import javax.xml.registry.*;
import javax.xml.registry.infomodel.*;
import javax.naming.*;
import java.util.*;

public class GetConn
{
    public static void main(String[] args)
    {
        try
        {
            Context ctx = new InitialContext();

            ConnectionFactory factory =
                (ConnectionFactory) ctx.lookup(
                    "javax.xml.registr.ConnectionFactory");
            
            Properties props = new Properties();

// Specify the implementation for the actual connection factory
            props.put("javax.xml.registry.factoryClass",
                "com.sun.xml.registry.uddi.ConnectionFactoryImpl");

// Specify the location of the inquiry and publish API's
            props.put("javax.xml.registry.queryManagerURL",
                "www-3.ibm.com/services/uddi/testregistry/inquiryapi");
            props.put("javax.xml.registry.lifeCycleManagerURL",
                "www-3.ibm.com/services/uddi/testregistry/publish");

// Store the properties in the factory
            factory.setProperties(props);

// Create the Connection
            Connection conn = factory.createConnection();

// Get the RegistryService
            RegistryService regService = conn.getRegistryService();

        }
        catch (Exception exc)
        {
            exc.printStackTrace();
        }
    }
}
