You are on page 1of 7

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 Oracles new Toolset WebUtil.
http://otn.oracle.com/products/forms/htdocs/webutil/webutil.htm

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.
http://otn.oracle.com/products/forms/htdocs/webutil/webutil_manual.pdf

PRE-REQUISITES
Your environment has to be at minimum :

Windows-NT, Windows 2000, Windows XP

Oracle9iDS Rel.2 v9.0.2

http://otn.oracle.com/software/products/ids/forms_content.html

JInitiator 1.3.1.8 +

http://otn.oracle.com/software/htdocs/devlic.html?/software/products/developer
/htdocs/jinit.htm

Java2 SDK 1.3.1. +

WebUtil 1.02

http://otn.oracle.com/software/products/forms/files/webutil/webutil_102.zip

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

Jacob 1.7 (http://danadler.com/jacob/Background.html)

Binary: http://danadler.com/jacob/jacobBin_17.zip

Sources (optional): http://danadler.com/jacob/jacobSrc_17.zip

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

Paper #

Track 36612

<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>
#Propertiesfileforsigner.bat&makecert.bat
#DefinestheoverallsettingsforSigningPJCjars
#Linesprefixedwith#areignored

#DirectorySettings**changethesetosuityoursystem**
#donotincludetrailing"\"
#JDK_HOME=D:\tools\jdk1.3.1
#JINIT_HOME=d:\ProgramFiles\Oracle\JInitiator1.3.1.9
JDK_HOME=C:\oracle\oraForms9\jdk
JINIT_HOME=C:\Programme\Oracle\JInitiator1.3.1.8
#Certificatesettings:
#Theseareusedtogeneratetheinitialsigningcertificate
#Changethemtosuiteyourorganisation
#DN_O=Oracle
#DN_C=US
DN_CN=ProductManagement
DN_OU=DevelopmentTools
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 >


signC:\oracle\oraForms9\forms90\WEBUTIL\lib\webutil.jar
signC:\oracle\oraForms9\forms90\WEBUTIL\lib\jacob.jar

Paper #

Track 36612

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\APPLICATIONDEPLOYMENTS\FORMS\FORMS90WEB


<?xmlversion="1.0"?>
<!DOCTYPEorionwebappPUBLIC"//Evermind//DTDOrionWebApplication2.3//EN"
"http://xmlns.oracle.com/ias/dtds/orionweb.dtd">
<orionwebapp
deploymentversion="9.0.2.0.0"
jspcachedirectory="./persistence"
temporarydirectory="./temp"
servletwebdir="/servlet/"
>
<contextparammapping
name="configFileName">C:\oracle\oraForms9/forms90/server/formsweb.cfg</context
parammapping>
<virtualdirectoryvirtualpath="/html"real
path="C:\oracle\oraForms9/tools/web90/html"/>
<virtualdirectoryvirtualpath="/java"real
path="C:\oracle\oraForms9/forms90/java"/>
<virtualdirectoryvirtualpath="/jinitiator"real
path="C:\oracle\oraForms9/jinit"/>
<virtualdirectoryvirtualpath="/webutil"real
path="C:\oracle\oraForms9\forms90\WEBUTIL\lib"/>
<sessiontrackingcookies="disabled"/>
</orionwebapp>
FORMS90.CONF IN

<ORAHOME FORMS9I>\FORMS90\SERVER

In the section with AliasMatches add one :


#WebutilErweiterung
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

Paper #

Track 36612

ORACLE_HOME=C:\oracle\oraForms9
#WebutilSection
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\oraF
orms9\forms90\WEBUTIL\lib\webutil.jar;C:\oracle\oraForms9\jdk\jre\lib\rt.jar;C:\ora
cle\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

Paper #

Track 36612

Screenshot of my WebUtil-Application

BUTTON TEXT_IO
declare
v_filetext_io.file_type;
v_stringvarchar2(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;
PROCEDUREOLE_Aufruf_CSIS
v_ole_excelole2.obj_type;
v_OLE_workbookole2.obj_type;
v_OLE_worksheetole2.obj_type;
v_OLE_Worksheetsole2.obj_type;
v_file_namevarchar2(2000):=
'C:\oracle\oraForms9\forms90\WEBUTIL\forms\spu.xls';
OBJ_HNDOLE2.OBJ_TYPE;
v_OLE_RangeOLE2.OBJ_TYPE;
arglistole2.list_type;

Paper #

Track 36612

v_OLE_WorkbooksOLE2.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','ThisistheTestwiththeOLE2
package');
END;

BUTTON CLIENT_TEXT_IO
declare
v_fileclient_text_io.file_type;
v_stringvarchar2(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
ifwebutil_file.file_exists('C:\oracle\oraForms9\forms90\WEBUTIL\forms\cs.txt')
then
message('fileexists');
else
message('filedon''texists');
endif;
end;

BUTTON CLIENT_OLE2
OLE_AUFRUF_Web;
PROCEDUREOLE_AUFRUF_WebIS
v_ole_excelclient_ole2.obj_type;
v_OLE_workbookclient_ole2.obj_type;
v_OLE_worksheetclient_ole2.obj_type;

Paper #

Track 36612

v_OLE_Worksheetsclient_ole2.obj_type;
v_file_namevarchar2(2000):=
'C:\oracle\oraForms9\forms90\WEBUTIL\forms\spu.xls';
OBJ_HNDclient_OLE2.OBJ_TYPE;
v_OLE_Rangeclient_OLE2.OBJ_TYPE;
arglistclient_ole2.list_type;
v_OLE_Workbooksclient_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','ThisistheTestwiththe
newclient_OLE2package');
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 dont write your own java beans. Its productiv, efficient
and the best way to get webenabled with Forms9i.
Just use it !
Gerd Volberg
Opitz Consulting

Paper #

You might also like