Track 36612

The Power of WebUtil

Gerd Volberg, Opitz Consulting GmbH

Introduction

This White Paper describes the installation, a demo application and my opinion about the future of Oracle’s new Toolset WebUtil.

Installation

In this section only the installation which finds use on my notebook is explained. Further information, as for example the complete installation for iAS, can be found in the document “WebUtil Familiarization Manual” from Duncan Mills.

Pre-Requisites

Your environment has to be at minimum :

  • Windows-NT, Windows 2000, Windows XP
  • Oracle9iDS Rel.2 v9.0.2
  • JInitiator 1.3.1.8 +
  • Java2 SDK 1.3.1. +
  • WebUtil 1.02

If you want to use the JavaComBridge from Dan Adler (for OLE-stuff, etc…) [optional]

  • Jacob 1.7 (
  • Binary:
  • Sources (optional):

Install WebUtil

Install WebUtil in the <ORAHOME Forms9i>\forms90 directory, e.g. for my installation:

<ORAHOME Forms9i> = C:\oracle\oraForms9

<WEBUTIL-Directory> = C:\oracle\oraForms9\forms90\WEBUTIL

<WEBUTIL-Forms> = C:\oracle\oraForms9\forms90\WEBUTIL\forms

<WEBUTIL-Library> = C:\oracle\oraForms9\forms90\WEBUTIL\lib

<WEBUTIL-Utilities> = C:\oracle\oraForms9\forms90\WEBUTIL\util

Copy Jacob.dll and Jacob.jar to <WEBUTIL-Library> [optional]

Changes to the Config Files

All modifications are printed in boldface

Signer.Properties in <WEBUTIL-Utilities>

#Properties file for signer.bat & makecert.bat

#Defines the overall settings for Signing PJC jars

#Lines prefixed with # are ignored

#Directory Settings - ** change these to suit your system **

#do not include trailing "\"

#JDK_HOME=D:\tools\jdk1.3.1

#JINIT_HOME=d:\Program Files\Oracle\JInitiator 1.3.1.9

JDK_HOME=C:\oracle\oraForms9\jdk

JINIT_HOME=C:\Programme\Oracle\JInitiator 1.3.1.8

#Certificate settings:

# These are used to generate the initial signing certificate

# Change them to suite your organisation

#DN_O=Oracle

#DN_C=US

DN_CN=Product Management

DN_OU=Development Tools

DN_O=OpitzConsulting

DN_C=DE

JAR_KEY=webutil

JAR_KEY_PASSWORD=webutil

Certificate and Sign the JAR-Files

Start a command-shell on the client.

Change directory to <WEBUTIL-Utilities>

C:

cd \oracle\oraForms9\forms90\WEBUTIL\util

Create certificate

makecert

Sign your JAR files in <WEBUTIL-Library >

sign C:\oracle\oraForms9\forms90\WEBUTIL\lib\webutil.jar

sign C:\oracle\oraForms9\forms90\WEBUTIL\lib\jacob.jar

Registry Changes

Append the following line to your FORMS90_BUILDER_CLASSPATH

C:\oracle\oraForms9\forms90\WEBUTIL\lib\webutil.jar

Orion-web.xml in <ORAHOME Forms9i>\j2ee\Oracle9iDS\application-deployments\forms\forms90web

<?xml version="1.0"?>

<!DOCTYPE orion-web-app PUBLIC "-//Evermind//DTD Orion Web Application 2.3//EN" "

<orion-web-app

deployment-version="9.0.2.0.0"

jsp-cache-directory="./persistence"

temporary-directory="./temp"

servlet-webdir="/servlet/"

<context-param-mapping name="configFileName">C:\oracle\oraForms9/forms90/server/formsweb.cfg</context-param-mapping>

<virtual-directory virtual-path="/html" real-path="C:\oracle\oraForms9/tools/web90/html" />

<virtual-directory virtual-path="/java" real-path="C:\oracle\oraForms9/forms90/java" />

<virtual-directory virtual-path="/jinitiator" real-path="C:\oracle\oraForms9/jinit" />

<virtual-directory virtual-path="/webutil" real-path="C:\oracle\oraForms9\forms90\WEBUTIL\lib" />

<session-tracking cookies="disabled" />

</orion-web-app>

forms90.conf in <ORAHOME Forms9i>\forms90\server

In the section with AliasMatches add one :

# Webutil Erweiterung

AliasMatch ^/forms90/webutil/(..*) "C:\oracle\oraForms9\forms90\WEBUTIL\lib/$1"

formsweb.cfg in <ORAHOME Forms9i>\forms90\server

At top of the parameter file add

webUtilArchive=/forms90/webutil/webutil.jar,/forms90/webutil/jacob.jar

Change parameters to

baseHTMLjinitiator=C:\oracle\oraForms9\forms90\WEBUTIL\server\webutiljini.htm

baseHTMLjpi=C:\oracle\oraForms9\forms90\WEBUTIL\server\webutiljpi.htm

baseHTML=C:\oracle\oraForms9\forms90\WEBUTIL\server\webutilbase.htm

default.env in <ORAHOME Forms9i>\forms90\server

After the ORACLE_HOME section add a webutil section

ORACLE_HOME=C:\oracle\oraForms9

#Webutil-Section

WEBUTIL_CONFIG=C:\oracle\oraForms9\forms90\WEBUTIL\server\webutil.cfg

At the end extend the classpath and the formspath as shown here

CLASSPATH=C:\oracle\oraForms9\jlib\debugger.jar;C:\oracle\oraForms9\jlib\ewt3.jar:C:\oracle\oraForms9\jlib\share.jar;C:\oracle\oraForms9\jlib\utj90.jar;C:\oracle\oraForms9\forms90\WEBUTIL\lib\webutil.jar;C:\oracle\oraForms9\jdk\jre\lib\rt.jar;C:\oracle\oraForms9\forms90\WEBUTIL\lib\jacob.jar;C:\oracle\oraForms9\jdk\jre\bin\classic\jvm.dll

FORMS90_PATH=C:\oracle\oraForms9\CGENF61\admin;C:\oracle\oraForms9\forms90\WEBUTIL\forms;C:\oracle\oraForms9\forms90

Changes in Forms

For all forms which have to be webutil-enabled:

  • attach WebUtil.pll to the Libraries
  • subclass WebUtil Objectgroup from the webutil.olb to the form

Modify all your code as you can see in the next section

Run your form and have fun with the new functionality

Demo Application

The following application is a little example for the easy use of the new WebUtil functionalities

WebUtil-Application

Screenshot of my WebUtil-Application

Button “TEXT_IO”

declare

v_file text_io.file_type;

v_string varchar2(2000);

begin

v_file := text_io.fopen ('C:\oracle\oraForms9\forms90\WEBUTIL\forms\cs.txt', 'r');

text_io.get_line (v_file, v_String);

message (v_String);

text_io.fclose (v_file);

end;

Button “OLE2”

OLE_Aufruf_CS;

PROCEDURE OLE_Aufruf_CS IS

v_ole_excel ole2.obj_type;

v_OLE_workbook ole2.obj_type;

v_OLE_worksheet ole2.obj_type;

v_OLE_Worksheets ole2.obj_type;

v_file_name varchar2 (2000) := 'C:\oracle\oraForms9\forms90\WEBUTIL\forms\spu.xls';

OBJ_HND OLE2.OBJ_TYPE;

v_OLE_Range OLE2.OBJ_TYPE;

arglist ole2.list_type;

v_OLE_Workbooks OLE2.OBJ_TYPE;

BEGIN

v_ole_excel := ole2.Create_obj ('Excel.Application');

OLE2.SET_PROPERTY ( v_ole_excel , 'visible', 1);

v_OLE_Workbooks := OLE2.GET_OBJ_PROPERTY (v_ole_excel, 'Workbooks');

arglist := ole2.create_arglist;

ole2.add_arg (arglist, v_file_name );

v_OLE_workbook := ole2.invoke_obj (v_OLE_workbooks, 'open', arglist);

ole2.destroy_arglist (arglist);

v_OLE_Worksheets := OLE2.GET_OBJ_PROPERTY (v_OLE_workbook, 'Worksheets');

arglist := ole2.create_arglist;

ole2.add_arg (arglist, 1);

v_OLE_Worksheet := OLE2.GET_OBJ_PROPERTY (v_OLE_Worksheets, 'Item', arglist);

ole2.destroy_arglist (arglist);

arglist := ole2.create_arglist;

ole2.add_arg (arglist, 'B1');

v_OLE_Range := OLE2.GET_OBJ_PROPERTY (v_OLE_Worksheet, 'Range', arglist );

ole2.destroy_arglist (arglist);

OLE2.SET_PROPERTY (v_OLE_Range, 'FormulaR1C1', 'This is the Test with the OLE2-package');

END;

Button “CLIENT_TEXT_IO”

declare

v_file client_text_io.file_type;

v_string varchar2(2000);

begin

v_file := client_text_io.fopen ('C:\oracle\oraForms9\forms90\WEBUTIL\forms\web.txt', 'r');

client_text_io.get_line (v_file, v_String);

message (v_String);

client_text_io.fclose (v_file);

end;

Button “FILE_EXISTS”

begin

if webutil_file.file_exists ('C:\oracle\oraForms9\forms90\WEBUTIL\forms\cs.txt') then

message ('file exists');

else

message ('file don''t exists');

end if;

end;

Button “CLIENT_OLE2”

OLE_AUFRUF_Web;

PROCEDURE OLE_AUFRUF_Web IS

v_ole_excel client_ole2.obj_type;

v_OLE_workbook client_ole2.obj_type;

v_OLE_worksheet client_ole2.obj_type;

v_OLE_Worksheets client_ole2.obj_type;

v_file_name varchar2 (2000) := 'C:\oracle\oraForms9\forms90\WEBUTIL\forms\spu.xls';

OBJ_HND client_OLE2.OBJ_TYPE;

v_OLE_Range client_OLE2.OBJ_TYPE;

arglist client_ole2.list_type;

v_OLE_Workbooks client_OLE2.OBJ_TYPE;

BEGIN

v_ole_excel := client_ole2.create_obj ('Excel.Application');

client_OLE2.SET_PROPERTY ( v_ole_excel , 'visible', 1);

v_OLE_Workbooks := client_OLE2.GET_OBJ_PROPERTY(v_ole_excel ,'Workbooks');

arglist := client_ole2.create_arglist;

client_ole2.add_arg (arglist, v_file_name );

v_OLE_workbook := client_ole2.invoke_obj (v_OLE_workbooks, 'open', arglist);

client_ole2.destroy_arglist (arglist);

v_OLE_Worksheets := client_ole2.GET_OBJ_PROPERTY(v_OLE_workbook ,'Worksheets');

arglist := client_ole2.create_arglist;

client_ole2.add_arg (arglist, 1);

v_OLE_Worksheet := client_ole2.GET_OBJ_PROPERTY(v_OLE_Worksheets, 'Item', arglist);

client_ole2.destroy_arglist (arglist);

arglist := client_ole2.create_arglist;

client_ole2.add_arg (arglist, 'B1');

v_OLE_Range := client_ole2.GET_OBJ_PROPERTY(v_OLE_Worksheet, 'Range', arglist );

client_ole2.destroy_arglist (arglist);

client_ole2.SET_PROPERTY (v_OLE_Range, 'FormulaR1C1', 'This is the Test with the new client_OLE2-package');

END;

The future

The installation of WebUtil is a little bit complex. I hope, there will be a more automated way to integrate and install the toolset.

WebUtil is the best toolset for web-developers in the forms-world. All the java-code written by oneself is now obsolete and can be substituted by WebUtil.

My opinion is: Use WebUtil and don’t write your own java beans. It’s productiv, efficient and the best way to get webenabled with Forms9i.

Just use it !

Gerd Volberg

Opitz Consulting

Paper #