Database Web Service Callout Utilitiy 10.1.3.1

User's Guide for Oracle Database Server 11g (11.1) and Oracle JAX-RPC Client

Note:

The purpose of this article is to provide a step-by-step instruction on how to install the DBWS Callout Utilities on Oracle Database Server 11g and how to verify that it works properly.

After completing this installation procedure, there will be an environment for an OC4J Standalone instance hosting a very simple document style web service and an environment for the Oracle Client. The article assumes that there is an environment for Oracle Database Server 11g already. All of this environments may be placed on different machines. Anyway, it has been found convenient to have this environments on one machine for an initial installation and test of the DBWS Callout Utilities. This does rule out network problems from affecting the proper operation of the DBWS Callout Utilities.

Contents

1. Preparing the Oracle Client and Oracle Database Server
2. Preparing OC4J Standalone to Run the Test Web Service "javacallout"
3. Generating and Running a Static Web Service Client Proxy
4. Running a PL/SQL Dynamic Invocation Interface (DII)
5. Downloads
6. Documentation

1. Preparing the Oracle Client and Oracle Database Server

  1. Setup the appropriate environment for the Oracle Client

    export ORACLE_BASE=/app/oracle
    export ORACLE_HOME=/app/oracle/product/client.11.1.0.6.0
    export PATH=.:$ORIG_PATH:$ORACLE_HOME/bin:$ORACLE_HOME/jdk/bin
    export LD_LIBRARY_PATH=$ORIG_LD_LIBRARY_PATH:$ORACLE_HOME/lib
    export TWO_TASK=db1110

    On Unix/Linux the environment variable TWO_TASK can be used to defines the default TNS alias for the database service to connect to. The equivalent name for the environment variable on Windows is "LOCAL".

    Alternatively the TNS alias can be qualified explicitly when connecting. Further details can be found in the documentation on SQL*Plus, JPublisher and loadjava (Java Developer's Guide 11g).

  2. Install Oracle Client 11.1.0.x with Installation Type "Administrator"

    This will install all the tools and jars required to work with the DBWS Callout Utilities.

  3. Configure a Oracle Net Alias According To the Environment Variable "TWO_TASK" respectively "LOCAL".

  4. Drop The Package "UTL_DBWS" in Schema "SYS"

    Later on this package will be installed into the schema dedicated for the classes of the DBWS Callout Utilities. It is only required in "SYS" if the DBWS Callout Utilities classes have been installed into "SYS".

    drop package UTL_DBWS;

  5. Check the OracleJVM for Invalid Classes

    The schema "SYS" and the schema into which the DBWS Callout Utilities should be installed must not have invalid classes. The status of all the java classes installed on the Oracle Database Server instance can be checked as SYSDBA with following SQL statement:

    SELECT owner, status, count(*) FROM DBA_OBJECTS
      WHERE OBJECT_TYPE='JAVA CLASS'
      GROUP BY owner, status;

    For a standard installation of Oracle Database Server 11.1 this SQL statement should return about 20000 valid classes for the owner/schema "SYS".

    It is very difficult to resolve invalid classes once they are in schema "SYS". There is a huge number of classes in this schema and it is not easy to find out the dependencies. It is a lot easier to resolve invalid classes in schemas, that are not system schemas of the Oracle Database Server, because in this case all uploaded jar files and classes with their dependencies should be known to the user.

    The complete reinitialization of the OracleJVM is usually the most efficient approach to resolve problems with invalid classes in schema "SYS", even though this is a risky and time consuming procedure. The following document gives clear advises:

    Note 457279.1 How to Reload the JVM in 11.1.0.x

    Note:

    Many users of the DBWS Callout Utilities have run into problems with invalid classes in schema "SYS" because they had followed the advises for Oracle SOAP and in addition the advises for Oracle JAX-RPC in the original "DBWS Callout Utilities 10.1.3.1 User's Guide", that ships with the product's download archive. The java archives required by Oracle SOAP and Oracle JAX-RPC do not match with each other. If the java archives have been installed into the schema "SYS", then the reinitialization of the OracleJVM is the most efficient approach to resolve the resulting problems.

  6. Configure the OracleJVM

    Preparing the database consists mainly in loading the Web Services client stack into the database. Loading the client stack requires extra Java space inside the OracleJVM to resolve and store load jar files. Make sure the initialization parameters SHARED_POOL_SIZE and JAVA_POOL_SIZE are equal to or greater than 132M and 80M, i.e.,

    shared_pool_size=132M
    java_pool_size=80M

    Depending on the number of Java classes already loaded into the database, the two parameters may need to be increased beyond 132M and 80M.

    In SQL*Plus you can check the size of this initialization parameters as SYSDBA:

    show parameter SHARED_POOL_SIZE
    show parameter JAVA_POOL_SIZE

    Oracle Database Server 10g is typically configured to use "Automatic Shared Memory Managerment". In this case the initialization parameters can be configured dynamically during runtime and no database restart is required.

    alter system set SHARED_POOL_SIZE=132M scope=both;
    alter system set JAVA_POOL_SIZE=80M scope=both;

  7. Download the Oracle DBWS Callout Utility 10.1.3.1

  8. Unzip the Content of the ZIP File to $ORACLE_HOME (Oracle Database Server Environment)

    e.g.:
    % unzip dbws-callout-utility-10131.zip sqlj/* -d $ORACLE_HOME
    % unzip dbws-callout-utility-10131.zip samples/* -d $ORACLE_HOME/sqlj
    % unzip dbws-callout-utility-10131.zip README* -d $ORACLE_HOME/sqlj

  9. Modify the CLASSPATH in $ORACLE_HOME/sqlj/bin/jpub

    TMPCLASSPATH=$ORACLE_HOME/sqlj/lib/dbwsa.jar:$ORACLE_HOME/jdk/lib/dt.jar:\
    $ORACLE_HOME/jdk/lib/tools.jar:\
    $ORACLE_HOME/jlib/jssl-1_1.jar:$ORACLE_HOME/jdbc/lib/ojdbc5.jar:\
    $ORACLE_HOME/sqlj/lib/runtime12.jar:$ORACLE_HOME/jlib/orai18n.jar:\
    $ORACLE_HOME/sqlj/lib/translator.jar:$ORACLE_HOME/javavm/lib/aurora.zip:\
    $ORACLE_HOME/rdbms/jlib/xdb.jar:$ORACLE_HOME/lib/xsu12.jar:\
    $ORACLE_HOME/jlib/jndi.jar:$ORACLE_HOME/rdbms/jlib/aqapi.jar:\
    $ORACLE_HOME/rdbms/jlib/jmscommon.jar:$ORACLE_HOME/lib/xmlparserv2.jar:\
    $CLASSPATH
    export TMPCLASSPATH

    Note:

    On Microsoft Windows operating systems a binary executable will be used to start JPublisher (jpub.exe). Therefore the classpath in the unix shell script will not be used. The environment variable CLASSPATH must be setup instead.

    set ORACLE_HOME=/app/oracle/product/client.11.1.0.6.0
    set CLASSPATH=%ORACLE_HOME%\sqlj\lib\dbwsa.jar;%ORACLE_HOME%\jdk\lib\dt.jar;^
    %ORACLE_HOME%\jdk\lib\tools.jar;^
    %ORACLE_HOME%\jlib\jssl-1_1.jar;%ORACLE_HOME%\jdbc\lib\ojdbc5.jar;^
    %ORACLE_HOME%\sqlj\lib\runtime12.jar;%ORACLE_HOME%\jlib\orai18n.jar;^
    %ORACLE_HOME%\sqlj\lib\translator.jar;%ORACLE_HOME%\javavm\lib\aurora.zip;^
    %ORACLE_HOME%\rdbms\jlib\xdb.jar;%ORACLE_HOME%\lib\xsu12.jar:^
    %ORACLE_HOME%\jlib\jndi.jar;%ORACLE_HOME%\rdbms\jlib\aqapi.jar;^
    %ORACLE_HOME%\rdbms\jlib\jmscommon.jar;%ORACLE_HOME%\lib\xmlparserv2.jar:^
    ;%CLASSPATH%
  10. Make JPublisher and JDK 1.5.0 available for an Oracle Client Operating System Shell

    Oracle Client 11g ships with a JDK 1.5.0 already. The JDK being used for JPublisher must match with the version of the OracleJVM the generated classes will be deployed to.

    e.g.:
    % export PATH=$ORACLE_HOME/jdk/bin:$PATH

    % echo $PATH
    /app/oracle/product/client.11.1.0.6.0/jdk/bin:/app/oracle/product/client.11.1.0.6.0/bin:/usr/local/bin:/usr/bin:.

  11. Load the WebService Client into Oracle Database Server

    % loadjava -u scott/tiger -r -v -f -genmissing dbwsclientws.jar dbwsclientdb11.jar

    Note:

    The loadjava commands above load the Oracle JAX-RPC client into the target schema. By default this classes will only be available for the target user. Other users require execute privileges and synonyms for this classes, if such users should also be able to have web service callouts.

    It is also possible to install this jar files into the user SYS and at the same time JPublisher can create public synonyms and grant the required privileges to PUBLIC.

    e.g.:
    % loadjava -u sys/change_on_install -r -v -f -genmissing -s -grant public dbwsclientws.jar dbwsclientdb11.jar

    The disadvantage of this approach is, that a number of classes in SYS will be replaced by more recent versions packaged with the loaded jar files. Whenever "dropjava" is used to remove this jar files from the user SYS, many other classes depending on the previously overwritten and now removed classes will be invalidated. It might be required to reinitialize the OracleJVM.

2. Preparing OC4J Standalone to Run the Test Web Service "javacallout"

  1. Download OC4J Standalone 10.1.3.3

  2. Unzip the Content of the ZIP File to $ORACLE_HOME (OC4J Standalone Environment)

    e.g. (ORACLE_HOME=/app/oracle/product/oc4j10133):
    % unzip oc4j_extended_101330.zip -d $ORACLE_HOME

  3. Make OC4J and JDK 1.5.0 Available for the OC4J Operating System Shell

    e.g.:
    % export JAVA_HOME=/app/oracle/product/client.11.1.0.6.0/jdk/bin
    % export ORACLE_HOME=/app/oracle/product/oc4j10133
    % export PATH=$ORACLE_HOME/bin:$PATH

  4. Run OC4J Standalone in One Operating System Shell

    % oc4j -start

    Note:

    When starting OC4J for the first time, you will be asked for a password for the administrator account "oc4jadmin". The following step uses the password "welcome".

    OC4J is ready to process requests as soon you see the message:
    "Oracle Containers for J2EE 10g (10.1.3.3) initialized"
    You can check the availability of the container by sending a request to
    the default application using the URL:
    http://localhost:8888

  5. Deploy the sample web service "javacallout" in a new Operating System Shell

    e.g.:
    % java -jar /app/oracle/product/oc4j10133/j2ee/home/admin_client.jar \
    deployer:oc4j:localhost:23791 oc4jadmin welcome -deploy \
    -file /app/oracle/product/client.11.1.0.6.0/sqlj/samples/javacallout.ear \
    -deploymentName javacallout -bindAllWebApps default-web-site

    Note:

    You can test the web service with following URL, if the deployment had been successful:
    http://localhost:8888/javacallout/javacallout

3. Generating and Testing a Static Web Service Client Proxy

  1. With SQL*Plus Grant the Required Privileges to the Target User as SYSDBA

    SQL> call dbms_java.grant_permission( 'SCOTT', 'SYS:java.lang.RuntimePermission', 'shutdownHooks', '' );
    SQL> call dbms_java.grant_permission( 'SCOTT', 'SYS:java.util.logging.LoggingPermission', 'control', '' );

    An additional privilege is required, if the web service client has not been installed into schema SYS, but into the target user (e.g. SCOTT).

    SQL> call dbms_java.grant_permission( 'SCOTT', 'SYS:java.lang.RuntimePermission', 'setFactory', '' );

  2. Create and Deploy the Web Service Client Proxy

    % jpub -u scott/tiger -sysuser sys/change_on_install \
    -proxywsdl=http://localhost:8888/javacallout/javacallout?WSDL \
    -endpoint=http://localhost:8888/javacallout/javacallout

    Note:

    The following resulting output shows some errors that can be ignored without concerns.

    tmp/src/genproxy/HttpSoap11ClientJPub.java
    plsql_wrapper.sql
    plsql_dropper.sql
    plsql_grant.sql
    plsql_revoke.sql
    Executing plsql_dropper.sql
    Executing plsql_wrapper.sql
    Executing plsql_grant.sql
    Loading plsql_proxy.jar
    errors : source genproxy/runtime/HelloServiceEJB_SerializerRegistry
      Note: Some input files use unchecked or unsafe operations.
      Note: Recompile with -Xlint:unchecked for details.
    errors : source genproxy/HttpSoap11ClientJPub
      Note: genproxy/HttpSoap11ClientJPub uses or overrides a deprecated API.
      Note: Recompile with -Xlint:deprecation for details.

  3. With SQL*Plus test the Sample Web Service as the Target User "SCOTT"

    SQL> select jpub_plsql_wrapper.sayhello('hello') from dual;

    JPUB_PLSQL_WRAPPER.SAYHELLO('HELLO')
    -----------------------------------
    HELLO!! You just said :hello

4. Running the PL/SQL Dynamic Invocation Interface (DII)

The UTL_DBWS PL/SQL package supports webservice invocation in DII fashion.  The following sample illustrates UTL_DBWS usage.
  1. Install The Package "UTL_DBWS" Into "SCOTT"

    If the DBWS Callout Utilities jar files had been installed into a dedicated schema, then the classes will not be available for the package "UTL_DBWS" in schema "SYS".

    SQL> @?/sqlj/lib/utl_dbws_decl.sql
    SQL> @?/sqlj/lib/utl_dbws_body.sql

  2. Create a Copy of Script "test-plsql-dii.sql"

    cp $ORACLE_HOME/sqlj/samples/test-plsql-dii.sql $ORACLE_HOME/sqlj/samples/my-test-plsql-dii.sql

  3. Remove the Schema Qualifiers From "my-test-plsql-dii.sql"

    The script qualifies the package "UTL_DBWS" with the schema "SYS". Now, that "UTL_DBWS" is located in the dedicated schema all the schema qualifiers can be removed.

  4. Modify the Web Service Endpoint in the Test Script "$ORACLE_HOME/sqlj/samples/test-plsql-dii.sql" as Required By the Test Web Service

    e.g.:
    utl_dbws.set_target_endpoint_address(call_, 'http://localhost:8888/javacallout/javacallout');

  5. With SQL*Plus run the script "test-plsql-dii.sql"

    SQL> @?/sqlj/samples/my-test-plsql-dii.sql

    PL/SQL DII client return HELLO!! You just said :hello
For RPC and DOC style invocation, use
utl_dbws.set_property(call_, 'OPERATION_STYLE', 'rpc');
and
utl_dbws.set_property(call_, 'OPERATION_STYLE', 'document');
respectively.

UTL_DBWS also support WS-Security, via the Oracle webservice client port configuration property. Here is a sample configuration for username token authentication.

        call_ := utl_dbws.create_call(service_);
        wsm := 'oracle.webservices.dii.interceptor.pipeline.port.config';
        config :='<port-info>' ||
                '<runtime enabled="security">' ||
                    '<security>' ||
                        '<outbound>' ||
                            '<username-token name="SCOTT" password="TIGER"/>' ||
                        '</outbound>' ||
                    '</security>' ||
                '</runtime>' ||
                '<operations>' ||
                    '<operation name="echoString"/>' ||
                '</operations>' ||
            '</port-info>' ;
        utl_dbws.set_property(call_, wsm, config);

5. Downloads

6. Documentation


References

Note 428775.1 - DBWS Callout Utilities User's Guide for RDBMS 10.1 or 10.2

Help us improve our service. Please email us your comments for this document.
E-mail this page
Printer View Printer View
Oracle Is The Information Company About Oracle | Oracle RSS Feeds | Careers | Contact Us | Site Maps | Legal Notices | Terms of Use | Privacy