Server Interface for Commands

 

Run application:

http://localhost:9090/LyciaWeb/sapi/default-1889/web_srv_func_sum.exe

 

Set value:

http://localhost:9090/LyciaWeb/sapi/set/{field}

Value is taken from request body.

 

Set focus:

http://localhost:9090/LyciaWeb/sapi/setfocus/{field}

The ‘field’ is the name of widget.

 

Send event:

http://localhost:9090/LyciaWeb/sapi/key/{name}

The ‘name’ is the event value. E.g. "accept".

 

Call 4GL function:

http://localhost:9090/LyciaWeb/sapi/call/{name}?p1=v1&p2=v2

The ‘name’ is the 4GL function name. The parameters are passed though request body or via parameters (optional). Function name should be started with "web_".

 

Get data:

http://localhost:9090/LyciaWeb/sapi/get

Read response from server.

 

Close window:

http://localhost:9090/LyciaWeb/sapi/closewindow

Close active 4GL form.

 

 

The server sends responses which are messages in XML-format. Codepage is UTF-8.

The examples of the server responses are provided further.

 

<?xml version="1.0" encoding="utf-8"?>

<setvalue>12345</setvalue>

 

<?xml version="1.0" encoding="utf-8"?>

<fglevent name="accept"/>

 

<?xml version="1.0" encoding="utf-8"?>

<setfocus>formonly.f001</setfocus>

 

<?xml version="1.0" encoding="utf-8"?>

<closewindow/>

 

<?xml version="1.0" encoding="utf-8"?>

<response>

 

<WriteToConsole>

<message>message text </message>

</WriteToConsole>

</response>

 

<?xml version="1.0" encoding="utf-8"?>

<response>

<openwindow>SCREEN</openwindow>

<displayat row="1" col="0" attr=""/>

<setfocus>Prompt Field</setfocus>

<interact_prompt/>

</response>

 

When you access application as a resource, there is a set of the command customers can use.

Below you can find the table with the command and their descriptions.

 

Function name

Result

FglEvent

 

Calls a specified action to be taken by the program on the server. Execution point of the application should be in the corresponding interaction statement.

CallMethod

Calls the specified Method by name. The parameter NAME must be indicated. The execution point should be in any interaction statement (PROMPT, MENU, INPUT, etc.). The call itself does not change its execution state, it is left in the interaction statement

You can set the option of which method can be called and which one cannot. The name of method should start with web_. This pattern can be set.

SetFocus

Sets the focus to the required field. The parameter NAME must be indicated. If you work with an array, specify the parameter ROW. Execution should be in the corresponding interaction statement; all the handlers, which are required to be called from moving focus from one field to another, will be executed.

SetValue

Sets the value for a specified field. Execution point of the application should be in the corresponding interaction statement.

CallMenuItem

Calls a specified menu item. The parameter NAME must be indicated. Execution point of the application should be in the corresponding interaction statement.

CallTopMenuItem

Calls a specified item from the top menu. Execution point of the application should be in the corresponding interaction statement.

CloseWindow

Closes the currently active window. Execution point of the application should be in the corresponding interaction statement. This simulates pressing close button on window title.

 

Developers can take field names directly from Lycia Theme Designer; it will save their time when wrapping 4GL application into web service as there is no need to read 4GL sources or forms.

 

 

 

Once server gets the request from client, it sends back a message informing about the corresponding action taken on server. Web client can either process data or ignore, if it does not assume handling of such messages. The list of the server responses that do not require any client's reply is as follows:

·         fgl_bell()

·         fgl_upload() and fgl_download()

·         fgl_dialog_setcursor()

·         fgl_dialog_setselection()

·         fgl_grid_export()

·         fgl_grid_viewexport()

·         exec_program()

·         fgl_winmessage()

·         fgl_setproperty()

·         WriteToConsole

·         WriteToTextViewer

·         ShowSystemMessageBox

·         open_url

·         start_program

·         RUN

·         DISPLAY ARRAY

·         INPUT

·         INPUT ARRAY

·         EXECUTE FUNCTION

 

Since 4GL supports a set of statements that allows users to interact with the program and to maintain its execution, server relates with the client by means of the number of interactions which the client must give response to.

 

·         interact_prompt()

·         interact_dialog()

·         interact_menu()

·         interact_fgl_getkey()

 

An XML schema defines the rules about how your request should be composed. Generally, you define this schema for each representation you wish to send to the web server.

 

XSD  (XML Schema Definitions ) formally describes the structure of XML  document. XSD is used to represent interrelations between the elements and attributes of an XML object. Here is the list of functions which represents functions. You can find the corresponding  XSD-schemes in the APPENDIX. XSD files for server response.

 

The functions updates a specified row in the array. The array and row number must be indicated as the parameters inside the function:

 

<updaterow name="arr_name" row="6">...</updaterow>

 

The function inserts a new row in the array. The array and row number must be indicated as the parameters inside the function:

 

<insertrow name="arr_name" row="6">...</ insertrow>

 

The function removes a row from the array. The array and row number must be indicated as the parameters inside the function:

 

<deleterow name="arr_name" row="6">...</deleterow >

 

The function displayed a specified form in the array. The array and row number must be indicated as the parameters inside the functions:

 

<displayform>form_name</displayform>

 

The function displays a specified value in the field. The name of the field must be indicated as the parameters inside the function; attributes and row number are optional:

 

<displayto field="field_name" attr="attributes" row="row_num_optional">string</displayto>

 

The function opens a window. Window name must be indicated:

 

<openwindow>window_name</openwindow>

 

The function displays the specified value at the row. The row and column must be indicated in the parameters:

 

<displayat row="2" col="4" attr="attributes">string</displayat>      

 

The function sets focus in the requested field. The row must be indicated in the parameters inside the function:

 

<setfocus row="row_num_optional">field_full_name</setfocus>

 

The function displays the result of the execution if the statement EXECUTE FUNCTIONS.

 

<results>...</results>

 

Besides the secondary list of responses from 4GL application, there is the list of functions that require the client` s response. Until the server receives the response from the client, the server will be in the waiting mode. These functions should be responded by client. Client does not have to perform them or to do some other action.

 

Querix 4GL supports Dynamic Data Exchange (DDE), a Microsoft communications protocol for exchanging data between applications. To invoke DDE, users can operate a whole number of functions:

§  DDEConnect()

§  DDEExecute()

§  DDEFinish()

§  DDEFinishAll()

§  DDEGetError()

§  DDEPeek()

§  DDEPoke()

 

The FrontCall method executes function calls to the current front end:

§  FrontCallExecute

§  FrontCallShellExec

§  FrontCallLaunchUrl

§  FrontCallGetWindowId

§  FrontCallOpenDir

§  FrontCallOpenFile

§  FrontCallSaveFile

§  FrontCallCbClear

§  FrontCallCbSet

§  FrontCallCbGet

§  FrontCallCbAdd

§  FrontCallCbPast

§  FrontCallHardCopy

 

Other functions:

§  fgl_dialog_getcursor()

§  fgl_dialog_getselectionend()

§  fgl_message_box

§  fgl_winquestion

§  fgl_winbutton

§  fgl_winprompt

§  fgl_file_dialog

§  fgl_getproperty

§  execute_menu() 

§  InterfaceGetContainer

§  InterfaceGetChildCount

§  WinExec

 

You can record and reply all the Web API messages that run the application in the GUI mode. To set up the option, add the corresponding environment variable to your inet.env file.

 

inet.env is a configuration file that contains environment variables required by GUI server. Double clicking the environment tab allows you to customize the settings in the form of environment variables.

 

 

 

In LyciaStudio, go to Window ->Preferences ->4GL ->Run/Debug ->GUI Servers. Choose the current GUI server instance and press the radio button Edit Environment.

 

Now, when the file is opened in the editor area of the Studio, find QXDEBUG in the list of current environment variables. Make sure that you have the underlined chars in this string:

 

QXDEBUG=!zA

 

Once you make the modifications, you will be able to check the recorded logs in the corresponding folder "logs". The default path to the folder is C:/ProgramData/Querix/Lycia6/logs. Every application is recorded to a single log file which looks as a plain text file. As output, you will receive files in the XML format. In the current version, this format is prevalent though, we are planning to extend the package of format (XML/HTML/JPEG/GIF/HEADLESS mode).

 

 

 

 

Contact Us

Privacy Policy

Copyright © 2024 Querix, (UK) Ltd.