Pages

Tuesday, June 21, 2016

Oracle Forms Developer & Webutil Configuration



Oracle Forms Developer & Webutil Configuration

ICONS SETTINGS (NOT Mandatory):
DEV_SUITE\forms\java\oracle\forms\registry\registry.dat
default.icons.iconpath=file:///C:\\icons (Not applicable for Application Server)
To show icons at design time go my computer properties go to tab advance and add environment variable at system variables

UI_ICON=C:\icons (Applicable for DEV_SUITE Only)
UI_ICON_EXTENSION =gif  (case sensitive) (Applicable for DEV_SUITE Only)

Make an entry in
DEV_SUITE\forms\server\forms.conf 
# Virtual path for ICONS (used to show icons in a form) AliasMatch ^/forms/icons/(..*) "C:\icons/$1"

Open Command Prompt
Set path=DEV_SUITE\jdk\bin;
command for jar file at dos prompt
go to c:\icons\ 
give this command to create jar icons file.
 jar –cvf icons.jar *.gif 
Where icons is name of folder


LOV SETTINGS 
DEV_SUITE\forms\java\oracle\forms\registry\registry.dat
app.ui.lovButtons=true.

FORMS PATH SETTINGS
Forms Path:
DEV_SUITE\forms\server\default.env
FORMS_PATH=DEV_SUITE\forms; D:\MyFolder;
Add new virtual form path other than dev_Suite/App_Server form path
Example: D:\MyFolder; (Note: The directory must be shared on Network)

Append this line FORMS_REJECT_GO_DISABLED_ITEM=FALSE,
After this FORMS_RESTRICT_ENTER_QUERY=TRUE

FORMS CONFIGURATION
Width and Height of explorer window which contains form ( Set these parameters according to your standards)

DEV_SUITE\forms\server\formsweb.cfg

Forms Size Setting
#Forms applet parameter
Width =100%
# Forms applet parameter
Height =100%

Hide oracle window in form (Not Applicable for Application Server)
#Otherparams
usesdi=yes

Hide window tool bar at explorer
separateFrame=true


Default Form Runtime Location (Applicable For Application Server)
#Forms runtime argument: which form module to run
form=login.fmx
# Forms runtime argument: database connection details userid=olplog/olplog@olpsys2

Icon Settings (To get icons from jar files) (Applicable for Application Server)

# Forms applet parameter
imageBase=codebase

Changing Key Function

DEV_SUITE\forms\fmrweb.res

9 : 0 : "Tab" : 1 : "Next Field"
 9 : 1 : "Shift+Tab" : 2 : "Previous Field"
 # 116 : 0 : "F5" : 3 : "Clear Field"
 38 : 0 : "Up" : 6 : "Up"
 40 : 0 : "Down" : 7 : "Down"
 33 : 0 : "PageUp" : 12 : "Scroll Up"
 34 : 0 : "PageDown" : 13 : "Scroll Down"
 69 : 2 : "Ctrl+E" : 22 : "Edit"
 10 : 0 : "Return" : 27 : "Return"
 120 : 0 : "F9" : 29 : "List of Values"
 115 : 0 : "F4" : 32 : "Exit"
 75 : 2 : "Ctrl+K" : 35 : "Show Keys"
 121 : 0 : "F10" : 36 : "Commit"
 118 : 1 : "Shift+F7" : 61 : "Next Primary Key"
 # 117 : 0 : "F6" : 62 : "Clear Record"
 117 : 0 : "F6" : 74 : "Clear Record"
 # 119 : 0 : "F8" : 74 : "Clear Form"
 38 : 2 : "Ctrl+Up" : 63 : "Delete Record"
 117 : 1 : "Shift+F6" : 64 : "Duplicate Record"
 40 : 2 : "Ctrl+Down" : 65 : "Insert Record"
 119 : 1 : "Shift+F8" : 66 : "Next Set of Records"
 1005 : 0 : "Down" : 67 : "Next Record"
 1004 : 0 : "Up" : 68 : "Previous Record"
 # 118 : 0 : "F7" : 69 : "Clear Block"
 66 : 2 : "Ctrl+B" : 70 : "Block Menu"
 34 : 1 : "Shift+PageDown" : 71 : "Next Block"
 33 : 1 : "Shift+PageUp" : 72 : "Previous Block"
 # 116 : 1 : "Shift+F5" : 73 : "Duplicate Field"
 # 116 : 1 : "Shift+F5" : 74 : "Clear Form"
 118 : 0 : "F7" : 76 : "Enter Query"
 # 122 : 2 : "Ctrl+F11" : 77 : "Execute Query"
 119 : 0 : "F8" : 77 : "Execute Query"
 112 : 1 : "Shift+F1" : 78 : "Display Error"


Webutil Configuration for DevSuit or AS
1-Copy webutil folder from DEV_SUITE/Forms to APP_SERVER/Forms
2- Copy frmwebutil.jar,forms_ie.js,forms_base_ie.js file from DEV_SUITE/Forms/Java To APP_SERVER/Forms/Java folder
3- Copy webutil.cfg, WebutilBase.htm, webutiljini.htm, webutiljpi.htm files from DEV_SUITE/Forms/Server folder to APP_SERVER/Forms/Server
4- Copy webutil.olb,Webutil.pll,webutil.plx files from DEV_SUITE/Forms folder toAPP_SERVER/Forms
Webutil Configuration
Download http://prdownloads.sourceforge.net/jacob-project/jacob_18.zip and extract to a temporary staging area.
1)      Copy jacob.jar to DEV_SUITE\forms\java\
2)      Copy jacob.dll to DEV_SUITE\forms\webutil\
3)      Sign frmwebutil.jar and jacob.jar
Open a DOS command prompt. Add DEV_SUITE \jdk\bin to the PATH:

     set PATH=DEV_SUITE\jdk\bin

Sign the files, and check the output for success:
DEV_SUITE\forms\webutil\sign_webutil DEV_SUITE\forms\java\frmwebutil.jar 
DEV_SUITE\forms\webutil\sign_webutil DEV_SUITE\forms\java\jacob.jar

4)       If you already have a schema in your RDBMS which contains the WebUtil stored code, you may skip this step.
Open DEV_SUITE/forms/create_webutil_db.sql in a text editor, then Copy it to a PLSQL editor   & compile it in to your required schema.
5)      Modify DEV_SUITE \forms\server\default.env, and append the below to the CLASSPATH entry:
DEV_SUITE\jdk\jre\lib\rt.jar;
DEV_SUITE\forms\java\jacob.jar;
WEBUTIL_CONFIG=/forms/server/webutil.cfg (If this entry not exists then add this)

6)      Modify DEV_SUITE \forms\j2ee\orion-web.xml , and append
         <virtual-directory virtual-path="/webutil"real-path="DEV_SUITE/forms/webutil" />

7)      WebUtil needs a single virtual directory to be defined in order to operate. This virtual directory is used to locate various operating system-specific files that WebUtil may need to download.

DEV_SUITE/forms/server/forms.conf

            Add the following line to the file
           # Virtual path for webutil
           AliasMatch ^/forms/webutil/(..*) DEV_SUITE /forms/webutil/$1"

8)      Modify DEV_SUITE \forms\server\formsweb.cfg insde [default] add :
(Note these line should be in this order to run webutil properly)

[webutil]
WebUtilArchive=frmwebutil.jar,jacob.jar
WebUtilLogging=off
WebUtilLoggingDetail=normal
WebUtilErrorMode=Alert
WebUtilDispatchMonitorInterval=5
WebUtilTrustInternal=true
WebUtilMaxTransferSize=16384
#baseHTMLjinitiator=webutiljini.htm (UnMark this to use JINITIATOR instead of JRE)
baseHTMLjinitiator=webutiljpi.htm
baseHTMLjpi=webutiljpi.htm
baseHTML=webutilbase.htm
archive_jini=frmall_jinit.jar,icons.jar (For Jinitiator)
archive=frmall.jar,icons.jar (For JRE)
lookAndFeel=oracle
9)      DEV_SUITE\forms\server\webutil.cfg
            transfer.database.enabled=TRUE
transfer.appsrv.enabled=TRUE


Sample Configuration Code:

Location: DevSuiteHome\forms\server\ formsweb.cfg

[TEST_WEB]
form=D:\WebuitilR2\planets_ole_excel_read.fmx
userId=username/pass@database
width=100%
height=100%
colorscheme=blue
lookAndFeel=oracle
pageTitle=Test Webutil :: Developed by Mr. ABC
#baseHTMLjinitiator=webutiljini.htm (For Jinitiator)
baseHTMLjinitiator=webutiljpi.htm
baseHTMLjpi=basejpi.htm
baseHTML=webutilbase.htm
#archive_jini=frmall_jinit.jar (For Jinitiator)
archive=frmall.jar,frmwebutil.jar,jacob.jar,icons.jar
separateFrame=false
WebUtilArchive=frmwebutil.jar,jacob.jar


Calling URL:

Start OC4J instance then run the url from explorer

http://IP_Address:8889/forms/frmservlet?config=test_web.

Run the form & enjoy!!!



Reference Link:
http://www.baigzeeshan.com/2010/01/open-file-dailog-box-example-using.html

Thursday, January 21, 2016

Calling web service from Database using PLSQL


Part-1Compile the below procedure & execute as you have required.

CREATE OR REPLACE PROCEDURE p_soap_request(p_username IN VARCHAR2, p_password IN VARCHAR2, p_proxy IN VARCHAR2) 
 IS 
  soap_request VARCHAR2(30000); 
  soap_respond CLOB; 
  http_req   utl_http.req; 
  http_resp   utl_http.resp; 
  resp     XMLType; 
  soap_err   exception; 
  v_code    VARCHAR2(200); 
  v_msg     VARCHAR2(1800); 
  v_len     number; 
  v_txt     Varchar2(32767); 
 BEGIN 
   UTL_HTTP.SET_PROXY(p_proxy); 
   -- Define the SOAP request according the the definition of the web service being called 
   soap_request:= '<?xml version = "1.0" encoding = "UTF-8"?>'|| 
           '<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">'|| 
           ' <SOAP-ENV:Body>'|| 
           '  <m:DownloadRequest xmlns:m="http://www.website.net/messages/GetDetails">'|| 
           '   <m:UserName>'||p_username||'</m:UserName>'|| 
           '   <m:Password>'||p_password||'</m:Password>'|| 
           '  </m:DownloadRequest>'|| 
           ' </SOAP-ENV:Body>'|| 
           '</SOAP-ENV:Envelope>'; 
   http_req:= utl_http.begin_request 
        ( 'http://www.website.net/webservices/GetDetailsService.asmx' 
        , 'POST' 
        , 'HTTP/1.1'); 
   utl_http.set_header(http_req, 'Content-Type', 'text/xml'); 
   utl_http.set_header(http_req, 'Content-Length', length(soap_request)); 
   utl_http.set_header(http_req, 'Download', ''); -- header requirements of particular web service 
   utl_http.write_text(http_req, soap_request); 
   http_resp:= utl_http.get_response(http_req); 
   utl_http.get_header_by_name(http_resp, 'Content-Length', v_len, 1); -- Obtain the length of the response 
   FOR i in 1..CEIL(v_len/32767) -- obtain response in 32K blocks just in case it is greater than 32K 
   LOOP 
     utl_http.read_text(http_resp, v_txt, case when i < CEIL(v_len/32767) then 32767 else mod(v_len,32767) end); 
     soap_respond := soap_respond || v_txt; -- build up CLOB 
   END LOOP; 
   utl_http.end_response(http_resp); 
   resp:= XMLType.createXML(soap_respond); -- Convert CLOB to XMLTYPE 
 Exception 
  when others then null; 
 END; 


Execute the above procedure as below:

Begin  
   p_soap_request(p_username =>'' ,p_password =>'' ,p_proxy =>'' );  
End;


Part-2: XML parsing after getting web service call (Assume that you know the expected output of XML).

Declare  
  response_env   varchar2(32767);  
  v_xml       XMLTYPE;  
  l_user_first_name varchar2(1000);  
  l_user_last_name varchar2(100);  
  l_error_value   varchar2(100);  
  ns        varchar2(200) := 'xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:axis2ns1="http://www.test.com/services"';  
 Begin  
  response_env := '<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">  
  <soapenv:Body>  
  <UserInfoObjResponse xmlns:axis2ns2="http://www.test.com/services">  
  <axis2ns2:FirstName >First Name Output</axis2ns2:FirstName>  
  <axis2ns2:LastName>Last Name Output</axis2ns2:LastName>  
  <axis2ns2:ErrorDescription/>  
  </UserInfoObjResponse>  
  </soapenv:Body>  
  </soapenv:Envelope>';  
  v_xml := XMLTYPE(response_env);  
  select EXTRACTVALUE(v_xml,'/soapenv:Envelope/soapenv:Body/UserInfoObjResponse/axis2ns1:FirstName',ns),  
      EXTRACTVALUE(v_xml,'/soapenv:Envelope/soapenv:Body/UserInfoObjResponse/axis2ns1:LastName',ns),  
      EXTRACTVALUE(v_xml,'/soapenv:Envelope/soapenv:Body/UserInfoObjResponse/axis2ns1:ErrorDescription',ns)  
   into l_user_first_name, l_user_last_name, l_error_value  
   from dual;  
  dbms_output.put_line('l_user_first_name: ' || l_user_first_name);  
  dbms_output.put_line('l_user_last_name : ' || l_user_last_name);  
 End;