Permission  Locate

The Oracle Service Registry Permission Demos are used to demonstrate the Oracle Service Registry application programming interface's capabilities and to demonstrate how to use this API.

You will learn how to set and search permissions.

The Oracle Service Registry security permission demo set contains the following demos to assist you in learning the Oracle Service Registry client API:

SetPermission Demonstrates how to construct and fill the Set_permission object, get a Permission stub for the UDDI registry, and perform the set_permission call.

WhoHasPermission Demonstrates how to construct and fill the Who_hasPermission object, get a Permission stub for the UDDI registry, and perform the who_hasPermission call.

GetPermission Demonstrates how to construct and fill the Get_permission object, get a Permission stub for the UDDI registry, and perform the get_permission call.

Prerequisites and Preparatory Steps: Code  Locate

We expect that you have already installed the Oracle Service Registry and set the REGISTRY_HOME environment variable to the registry's installation location.

To run the Oracle Service Registry's demos, your registry must be running.

It is necessary to configure the demos. The configuration system has two levels: global and local. The properties defined at the global level may be overwritten at the local level. The global properties are located in the file:

Windows: %REGISTRY_HOME%\demos\

The values set during the installation of the Oracle Service Registry work out of the box, and their modification affects all demos. If you need to redefine a property's value for a single demo (that is,, at the local level), edit This file is located in the same directory as the file (run.bat). Local level properties for the Permission demos are loaded from the file:

Windows: %REGISTRY_HOME%\demos\security\permission\
UNIX: $REGISTRY_HOME/demos/security/permission/

Table 14. Properties Used in Demos

NameDefault ValueDescription
uddi.demos.url.permissionhttp://localhost:8888/registry/uddi/permissionthe permission Web service port URL
uddi.demos.url.securityhttp://localhost:8888/registry/uddi/securitythe security Web service port URL

Presentation and Functional Presentation  Locate

This section describes the programming pattern used in all demos using the SetPermission demo as an example. You can find this demo's source code in the file:

Windows: %REGISTRY_HOME%\demos\security\permission\src\demo\uddi\permission\
UNIX: $REGISTRY_HOME/demos/security/permission/src/demo/uddi/permission/

The main method is divided into two parts. The first part serves to configure the demo by the user. It reads the credentials of the user who will run the demo and is allowed to set permissions. Then it reads permission type, name, and action.

The second part contains the execution of the demo. It looks up the security stub and authenticates the user. It then creates a Set_permission object and sends it over SOAP to the UDDI registry as a set_permission operation. If the user has explicitly declared permissions that are not present in this operation, these will be removed.

String user = UserInput.readString("Enter login","admin");
String password = UserInput.readString("Enter password","changeit");
String principal = UserInput.readString("Enter principal type", PrincipalType.user.getValue());
String login = UserInput.readString("Enter login/group name", 
String type = UserInput.readString("Enter permission type", 
String name = UserInput.readString("Enter permission name", 
String action = UserInput.readString("Enter action", "download_taxonomy");

UDDI_Security_PortType security = getSecurityStub();
String authInfo = getAuthInfo(user, password, security);
Set_permission set = createSetPermission(login, principal, name, type, action, authInfo);
discardAuthInfo(authInfo, security);

The method createSetPermission creates an object representing the set_permission operation.

public static Set_permission createSetPermission(String login, String principal,
  String name, String type, String action, String authInfo) throws InvalidParameterException {
    System.out.println(principal+", login/name = " + login);
    System.out.println("type = " + type);
    System.out.println("name = " + name);
    System.out.println("action = " + action);

    PermissionDescriptors permissionDescriptors = new PermissionDescriptors();
    permissionDescriptors.setPrincipal(new Principal(login, PrincipalType.getPrincipalType(principal)));
    PermissionDescriptor descriptor = new PermissionDescriptor();

    Set_permission set = new Set_permission();

    return set;

The helper method, getPermissionStub(), returns the UDDI Permission stub of the Web service listening at the URL specified by the URL_PERMISSION property.

public static PermissionApi getPermissionStub() throws SOAPException {
// you can specify your own URL in property - uddi.demos.url.permission
String url = DemoProperties.getProperty(URL_PERMISSION, "http://localhost:8888/registry/uddi/permission");
System.out.print("Using Permission API at url " + url + " ..");
PermissionApi permission = PermissionStub.getInstance(url);
System.out.println(" done");
return permission;

The Oracle Service Registry API call set_permission is performed in the method setPermission.

public static void setPermission(Set_permission set) throws
  SOAPException, PermissionException {
    PermissionApi permissionApi = getPermissionStub();
    System.out.print("Save in progress ...");
    System.out.println(" done");

Building and Running Demos  Locate

This section shows how to build and run the Oracle Service Registry Permission demos.

  1. Be sure that the demos are properly configured and the Oracle Service Registry is up and running.

  2. Change your working directory to

    Windows: %REGISTRY_HOME%\demos\security\permission
    UNIX: $REGISTRY_HOME/demos/security/permission

  3. Build demos using:

    Windows: run.bat make
    UNIX: ./ make


    When compiling demos on Windows platforms, you may see the following text:

    A subdirectory or file ..\..\common\.\build\classes already exists.

    This is expected and does not indicate a problem.

  4. To get list of all available commands, run

    Windows: run.bat help
    UNIX: ./ help

  5. The selected demo can be executed via the run command using the name of the demo as a parameter. For example, to run the SetPermission demo, invoke

    Windows: run.bat SetPermission
    UNIX: ./ SetPermission

    The output of this demo will resemble the following:

    Running SetPermission demo...
    Setting permission where
    Enter login [admin]:
    Enter password [changeit]:
    Enter principal type [user]:
    Enter login/group name [demo_john]:
    Enter permission type []:
    Enter permission name [org.systinet.uddi.client.taxonomy.v3.TaxonomyApi]:
    Enter action [download_taxonomy]:
    Using Security at url .. done
    Logging in .. done
    user, login/name = demo_john
    type =
    name = org.systinet.uddi.client.taxonomy.v3.TaxonomyApi
    action = download_taxonomy
    Using Permission API at url .. done
    Save in progress ... done
    Logging out .. done
  6. To rebuild demos, execute run.bat clean (./ clean) to delete the classes directory and run.bat make (./ make) to rebuild the demo classes.