Example Client Client Authentication

Example 3. ExampleClient.java c Copyright 2001-2008 Hewlett-Packard Development Company, L.P. Use is subject to license terms. import org.systinet.uddi.client.v3.UDDIPublishStub; import org.systinet.uddi.client.v3.UDDI_Publication_PortType; import org.systinet.uddi.client.v3.struct.; public class ExampleClient { public static void mainString[] args { String registryBaseUrl = System.getPropertyregistry.base.url,http:localhost:8080; String urlPublishing = registryBaseUrl+ uddipublishing; System.out.printUsing publishing URL +urlPublishing + .; try { UDDI_Publication_PortType publish = UDDIPublishStub.getInstanceurlPublishing; System.out.printlnpublish.save_businessnew Save_business new BusinessEntityArrayListnew BusinessEntitynew NameArrayList new NameCreated by Client Authentication Example; System.out.println done; } catch Exception e { e.printStackTrace; } } } The client is created as follows: 1. Create the directory CLIENT_HOME. 2. Create a client class in the CLIENT_HOME directory. The example client is shown in Example 3, ExampleClient.java . The client contains no security calls or structures. Client-side security is configured later using properties supplied to the java command that runs the client. 3. In CLIENT_HOME, create the lib subdirectory. Copy the jar files required for compilation and client execution to this directory. All the jars are in the Oracle Service Registry installation directory. They are: • libactivation.jar • libbuiltin_serialization.jar • libcore_services_client.jar • libjaxm.jar • libjaxrpc.jar • libjetty.jar • liblog4j.jar • libsaaj.jar Page 526

2.5.1. Example Client

• libsecurity-ng.jar • libsecurity2-ng.jar • libsecurity_providers_client.jar • libwasp.jar • libwsdl_api.jar • libxalan.jar • libxercesImpl.jar • libxml-apis.jar • distuddiclient_core.jar • distuddiclient_api_ v3.jar 4. In CLIENT_HOME, create the conf subdirectory. Copy configuration files required to run the client to this directory. These files are also in the Oracle Service Registry installation directory: • confclientconf.xml • confpackage12.xml • confpackage13.xml • confjaas.config 5. Compile the example client class using a CLASSPATH that includes all jar files in the lib subdirectory of CLIENT_HOME Before running the client, configure registry to one of the authentication schemes described in Section 8.1, HTTP Basic or Section 8.3, SSL Client authentication with Embedded HTTPHTTPS Server . If you want to configure a deployed registry for SSL client authentication, follow the instructions given in Section 8.5, J2EE Server Authentication To run the client: 1. Use a classpath that includes all jar files from CLIENT_HOMElib, and the directory containing the compiled example class. 2. Add the following property definitions to the java command line: • -Dwasp.location=CLIENT_HOME • -Djava.security.auth.login.config=CLIENT_HOMEconfjaas.config 3. To run the client with HTTP Basic authentication add the following command-line options: • -Dwasp.username=USERNAME • -Dwasp.password=PASSWORD Page 527

2.5.1. Example Client

• -Dwasp.securityMechanism=HttpBasic • -Dregistry.base.url=http:HOST:PORTCONTEXT Use the credentials of a registered user instead of USERNAME and PASSWORD. To register a new user, start with the main page of registry console. See Section 2, Registry Consoles for details. If you imported demo data during installation, you can also use the demo user demo_john with password demo_john. The base URL for registry is specified using the registry.base.url property as shown in Example 3, ExampleClient.java . Replace HOST,PORT and CONTEXT to match your registry deployment; for example http:pc1.example.com:8080 . 4. To run the client with SSL client authentication add the following command-line options: • -Dwasp.username=USERNAME • -Dwasp.password=PASSWORD • -Dwasp.securityMechanism=SSL • -Dregistry.base.url=https:HOST:PORTCONTEXT Unlike HTTP Basic authentication, USERNAME and PASSWORD are used to obtain the client identity from a local protected store. You must import the client identity using the instructions provided in Section 9, SSL Tool . The protected store of the example client is in the file CLIENT_HOMEconfclientconf.xml. You must also import a server certificate or the certificate of a certification authority that issued the server certificate to the same protected store using the instructions provided in Section 8, PStore Tool . Use an alias in the protected store instead of USERNAME. PASSWORD stands for the password that is used to protect the private key stored under that alias. The base URL for registry is specified using the registry.base.url System property as shown in Example 3, ExampleClient.java . Replace HOST,PORT and CONTEXT to match your registry deployment; for example https:pc1.example.com:8443 .

3. Server-Side Development

This chapter focuses on the server-side development of Oracle Service Registry extensions. Possible ways of accessing Oracle Service Registry are discussed including examples. • Accessing backend APIs via servlet deployed on an application server. • Custom Oracle Service Registry Modules - how to create and deploy custom Oracle Service Registry modules. • Interceptors can monitor or modify the requests and responses of Oracle Service Registry. Interceptors are at the lowest level of Oracle Service Registry API call processing. • Writing custom Validation services - Oracle Service Registry provides several ways to define and use validation services for taxonomies or identifier systems inluding remotely and locally deployed validation services and an internal validation service. For details, please see Users Guide, Section 5.4, Taxonomy: Principles, Creation and Validation . This chapter focuses how to create a validation service. • Writing subscription notification services - How to implement subscription notification service deployed on Systinet Server for Java. • JSP Framework - This section covers the Web Framework. Page 528

3. Server-Side Development

• Business Service Control Framework - This section covers the Business Service Control Framework.

3.1. Accessing Backend APIs

This section will show you how to integrate Oracle Service Registry with your application. Your application can be deployed as a servlet to the same context of the application server as the registry. In this case, the servlet of your application can access instances of Oracle Service Registry APIs as shown in Figure 5 . Figure 5. Accessing Backend Registry APIs - Architecture View The sequence of steps that precedes access to the Oracle Service Registry API is shown in Figure 6 . 1. Oracle Service Registrys API implementations are registered in the WASP context during the boot of the registry. 2. The example servlet deployed in the WASP context calls the getInstance method with the required UDDI Registry interface as a parameter to obtain a reference of the interface implementation. 3. The example servlet can call the API methods of Oracle Service Registry. Figure 6. Accessing Backend Registry APIs - Sequence Diagram Follow these steps to create and deploy the example servlet: 1. Create the example servlet class shown in Example 4, ExampleServet.java . Compile the ExampeServlet.java using: javac -classpath REGISTRY_HOME\dist\uddiclient_api_v3.jar; REGISTRY_HOME\dist\uddiclient_core.jar; Page 529

3.1. Accessing Backend APIs