Skip to content

New Oracle Forms 12.2.1.3 feature for WebSocket sending or synchronous receiving from Forms to a Web Browser engine.

Notifications You must be signed in to change notification settings

Fxztam/FormsWebSocketBasic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 

Repository files navigation

FormsWebSocketBasic

Websockets is a two-way extremely powerful communication protocol, you can find here a very good summary from Oracle: http://www.oracle.com/technetwork/cn/community/developer-day/6-java-html5websocket-app-2196804-zhs.pdf

The Oracle Forms 12.2.1.3 new feature 'Websocket JS Interface' - WJSI - allows the connection to a Web Browser session for sending events/data or synchronous receiving data per JS function call, this is a one-way peer-to-peer implementation: Forms calls exactly one JS client point.

The Demo chk_websocket.fmb/chk-websocket.html tries to explain the basic functions with good transparency.

Forms test module started with Forms Stand-alone Application Launcher:

Getting Started

This Oracle Forms Demo was inspired from:

Prerequisites

Setup and Deployment

Following subsequent setups are from: https://community.oracle.com/message/14655456#14655456

Get and Set a free Websocket port

  1. Select a free port for Websocket
  2. In chk_websocket.fmb : Set the PARAMETER.P_PORT=\<your-free-port>
  3. In chk-websocket.html: Find & set "frmwebsocketjsi.connectToServer(\<your-free-port>);"

Environment setup goes something like this

1. Download the Jetty server from :
   http://central.maven.org/maven2/org/eclipse/jetty/aggregate/jetty-all/9.4.5.v20170502/jetty-all-9.4.5.v20170502-uber.jar
   (from the Deployment Guide).
2. Properly sign the jar.
3. Copy the jar to the /forms/java directory.
4. Add the jar file to ARCHIVE (or extensions.jnlp if using Web Start).
5. Add frmwebsocketjsi.jar to ARCHIVE.
6. Config in the formsweb.cfg:
   * enableJavascriptEvent=true
   * JavaScriptBlocksHeartBeat=true
7. Place chk-websocket.html in /forms/java directory for starting:
   `http://<your-forms-host>:<your-forms-port>/forms/java/chk-websocket.html`

Application setup

1.  Compile websocketJSI.pll in the forms directory and save websocketJSI.plx there
2.  Create a new form and attach websocketJSI.pll to your form.
3.  Add object group from websocketJSI.olb per drag and copy
4.  Be sure you have defined your free port in chk_websocket.fmb and chk-websocket.html

Programming

In the chk_websocket.fmb:

  1. Start server : websocketJSI.StartServer(7778);
  2. Start session: websocketJSI.BeginSession(7778, 'MyFxSession');
  3. Send/receive events/data in WHEN-BUTTON-PRESSED (BT_SEND_JS):

You have located the chk-websocket.html in the /forms/java directory, some code lines from this source here:

  1. In the HTML page, add a reference to the needed JS file, the file location is in /forms/java
    <script type="text/javascript" src="/forms/java/frmwebsocketjsi.js"></script>
  1. Add JS code to connect to the websocket server from the HTML page.
    frmwebsocketjsi.connectToServer(7778);
  1. Add JS code to connect to the desired session from the HTML page. Example:
    frmwebsocketjsi.beginSession('MyFxSession');

See further the functions behind the buttons in chk_websocket.fmb and chk-websocket.html.

Running the tests

The WJSI fetures in this demo were tested on the IE11 Java plugin and the Forms Application Launcher, based on Java Version 1.8_161.

Start with Forms Stand-alone Application Launcher (FSAL)

The cmd file for starting with FSAL: https://github.com/Fxztam/FormsWebSocketBasic/blob/master/start_websocket-demo.cmd

Following flow was succesfully tested:

  1. Start the chk_websocket.fmx:
    • press 'Start Server'
    • press 'Server State?'
    • press 'Start Session'
    • press ' Session State?'
    • press 'Session ID?'
  2. If all ready here, then next:
  3. Open the chk-websocket.html:
    • open in the Browser 'Development Tools' 'Console'
    • press 'Connect Server' in the chk-websocket.html
    • press 'Begin Session'
  4. The web page session is started.
  5. Interaction via JS can begin:
  6. In the Form select in ComboBox:
    • 'Alert' press 'Send JavaScript'
    • 'Check Console' press 'Send JavaScript'
    • 'Get Item' press 'Send JavaScript'
    • 'Get Date> press 'Send JavaScript'
    • 'Prompt' press 'Send JavaScript'
    • 'Set Item' press 'Send JavaScript'
  7. Finishing the Websocket Service from chk_websocket.fmx
    • press 'Stop Session'
    • press 'Stop Server'.

You can check the availability of a Websocket Port: press 'Port Check'.

Here the demo:

Try this link "www.fmatz.com/WS-Forms-final.gif" for the full movie.

Known issues

The flow above is important, errors due to deviations from the flow must be remedied by restarting.

About

New Oracle Forms 12.2.1.3 feature for WebSocket sending or synchronous receiving from Forms to a Web Browser engine.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published