Forum Stats

  • 3,750,259 Users
  • 2,250,141 Discussions
  • 7,866,877 Comments

Discussions

WJSI setup (websocketJSI) is not working on Oracle forms 12.2.1.4

Giriraj Bahediya
Giriraj Bahediya Member Posts: 32 Red Ribbon
edited Jun 15, 2021 11:26AM in Forms

I am facing some issue on WJSI setup for Oracle forms FSAL application.

Performed below steps:

Environment Setup-

1. Download the Jetty server jar.

2. Get Jetty-All.jar signed.

3. Copied the jar to the /forms/java directory.

4. Added Jetty-all.jar file reference to ARCHIVE.

5. Added frmwebsocketjsi.jar to ARCHIVE.

6. Config done in the formsweb.cfg:

enableJavascriptEvent=true

JavaScriptBlocksHeartBeat=true

Application side setup:

1. Compiled websocketJSI.pll and save websocketJSI.plx to libraries folder on app server.

2. Attached websocketJSI.pll to form.

3. Added object group from websocketJSI.olb to form.


Please help!

@Michael Ferrante-Oracle

Tagged:
«1

Answers

  • Michael Ferrante-Oracle
    Michael Ferrante-Oracle Senior Principal Product Manager USMember Posts: 6,803 Employee

    "... is not working..." - This is always so funny to me 🤣

    What exactly does "is not working" mean?

    • When you make the appropriate call nothing happens...
    • When you make the appropriate call there is an error and that error is...
    • When you make the appropriate call the client (Java) crashes...
    • When you make the appropriate call the server (frmweb) crashes...
    • , , ,

    Details are needed in order for anyone to offer anything useful.

    Also needed is the exact Java version you are using and the platform on which you are using for the client.

  • Giriraj Bahediya
    Giriraj Bahediya Member Posts: 32 Red Ribbon

    When I make a call to websockerJSI via forms button nothing happens.

    Oracle Forms version - 12.2.1.3 (Solaris sparc 11.3)

    Java version - version 8 update 171 (build 1.8.0_171-b11)

    Client Machine - Windows 10

    @Michael Ferrante-Oracle - Please let me know in case of more information required.

  • Michael Ferrante-Oracle
    Michael Ferrante-Oracle Senior Principal Product Manager USMember Posts: 6,803 Employee

    In order to use websocketJSI there are a variety of things that are required in addition to what you mentioned:

    .1. Your web page must include a reference the provided JS file frmwebsocketjsi.jsThis is explained in the documentation (URL below).

    .2. "Jetty" is a light weight server. In order to use it, you must "start" it from Forms then start a session then connect to the web page. In the web page, you must also connect to the Jetty server and the session created by the form.

    So something like this:

    In a Forms application that has websockjsi.pll attached, you would need to execute the following (in this order) :

    Start server

    -- Be sure to use an unused port. You can test for that.   
    websocketJSI.StartServer(32767);
    

    Begin new websocket session

    -- If server is running, start session. Sessioin name can be almost anything
    websocketJSI.BeginSession(32767, ‘frmwjsisession’);
    

    In the web page, in addition to referencing the noted JS file, the following must be executed:

    frmwebsocketjsi.connectToServer(32767);
    frmwebsocketjsi.beginSession('frmwjsisession');
    


    To get an idea of what can be called in Forms, open websocketJSI.pll and review the Package Spec.


    References:

    https://www.oracle.com/a/tech/docs/oracleforms-1221-newfeatures.pdf

    https://docs.oracle.com/en/middleware/developer-tools/forms/12.2.1.4/working-forms/oracle-forms-and-javascript-integration.html#GUID-F38EE72E-FE26-49C0-AEC6-F5F9F65FBFFF

  • fmz
    fmz Member Posts: 69 Red Ribbon

    Hi,

    you can try my WJSI demo here https://github.com/Fxztam/FormsWebSocketBasic

    Hope that helps,

    Friedhold

  • Giriraj Bahediya
    Giriraj Bahediya Member Posts: 32 Red Ribbon
    edited Jun 17, 2021 12:47PM

    Thanks @Michael Ferrante-Oracle and @fmz for sharing the useful information.

    My requirement is to show the HTML table content to HTML page via javascript (innerHTML) so there is no physical HTML file which I can display.

    Below is the example code:

    websocketJSI.StartServer (27005);

    websocketJSI.BeginSession(27005, 'MyFxSession');

    htmlvar := 'var win = window.open('''',''XXXXX'',''scrollbars=yes,menubar=no,location=no,resizable=yes'');' ||CHR(10)||'win.document.title = "XXXXX";'||CHR(10)|| 'win.document.body.innerHTML='''||<HTML>|| ||CHR(10)||'win.document.close();';

    websocketJSI.javascript_eval_expr(htmlvar);

    Kindly suggest me, where I need to do these (HTML) entries:

    frmwebsocketjsi.connectToServer(32767);
    frmwebsocketjsi.beginSession('frmwjsisession');
    

    Thanks

    Giriraj Bahediya

  • Michael Ferrante-Oracle
    Michael Ferrante-Oracle Senior Principal Product Manager USMember Posts: 6,803 Employee

    You will not be able to display HTML content, which includes JS, without something to host/contain it. Remember it is the browser that processes the HTML/JS code. So there must be a browser running regardless of whether or not anything is displayed in that browser.

    In your example, code, "window.open" will open a browser window but requires a parent browser to process that code.

  • Giriraj Bahediya
    Giriraj Bahediya Member Posts: 32 Red Ribbon

    Hi @Michael Ferrante-Oracle ,

    I have done the mentioned configuration but still not able to start Jetty server from Oracle forms.

    I have downloaded by attached jar (jetty-all-9.4.5.v20170502-uber.jar) then renamed the same to jetty-all.jar and placed in /forms/java folder..done with all configuration mentioned above.

    Please help!


  • fmz
    fmz Member Posts: 69 Red Ribbon

    You have to sign your jetty-all.jar with a Code Certificate from a Trusted Certificate Authority.

  • Giriraj Bahediya
    Giriraj Bahediya Member Posts: 32 Red Ribbon

    Hi @fmz ,

    Yes, I have already signed jetty-all.jar as mentioned in the documentation and finally this has started working on my local machine.

    Also I have put below code in my html page:

    " <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

      <script src=".\frmwebsocketjsi.js" type="text/javascript"></script>

    <script>

      frmwebsocketjsi.connectToServer(12345);

      frmwebsocketjsi.beginSession('MySession');   

      window.name = 'win';"


    And on Oracle form:

    "websocketJSI.StartServer (12345);

     websocketJSI.BeginSession(12345, 'MySession');

    websocketJSI.javascript_eval_expr('win.document.body.innerHTML....

    WebsocketJSI.EndSession();

    WebsocketJSI.StopServer;"

    The same code was working on browser application with "web.javascript_eval_expr" but not working on FSAL applocation.

    @fmz @Michael Ferrante-Oracle, Please help!

  • Michael Ferrante-Oracle
    Michael Ferrante-Oracle Senior Principal Product Manager USMember Posts: 6,803 Employee

    You cannot use the "WEB" package with Web Start or FSAL (e.g. "web.javascript_eval_expr"). Take a look at the Forms New Features paper as it provides an overview of what needs to be done. In short, you need to change your "web." calls to "websocketJSI."

    Before:

    web.javascript_eval_expr(:block1.JSEXPR);

    After:

    websocketJSI.javascript_eval_expr(:block1.JSEXPR);


    https://www.oracle.com/application-development/technologies/forms/forms.html#panel2

    fmz