Web Apps
Web Apps
V E R S I O N 2018.0.01
You should be very careful to ensure that the use of this software material and/or information complies with the laws, rules, and regulations
of the jurisdictions with respect to which it is used. No part of this document may be reproduced or transmitted in any form or by any means,
electronic or mechanical, for any purpose, without the express written permission of Jade Software Corporation Limited.
The information contained herein is subject to change without notice. Revisions may be issued to advise of such changes and/or additions.
JADE is a trademark of Jade Software Corporation Limited. All trade names referenced are the service mark, trademark, or registered
trademark of the respective manufacturer.
For details about other licensing agreements for third-party products, you must read the JADE ReadMe.txt file.
Contents
Contents iii
WebApps - 2018.0.01
Web Application Guide
Contents iv
WebApps - 2018.0.01
Web Application Guide
Contents v
Consumer Command 49
Open Command 50
Append New Command 51
Save Command 51
Save As Command 51
Exit Command 52
Web Application Configuration Examples 52
Configuration 1: Minimum 52
Configuration 1 - JadeHttp.ini File 53
Configuration 1 - Web Application Configuration File 53
Configuration 2: Parallel Requests 53
Configuration 2 - JadeHttp.ini File 54
Configuration 2 - Web Application Configuration File 54
Configuration 3: Multiple Connection Groups 55
Configuration 3 - JadeHttp.ini File 55
Configuration 3 - Web Application Configuration File 55
Configuration 4: Multiple JADE Nodes 56
Configuration 4 - JadeHttp.ini File 57
Configuration 4 - Web Application Configuration File 57
Configuration 5: Multiple Application Copies in Multiple Nodes 58
Configuration 5 - JadeHttp.ini File 58
Configuration 5 - Web Application Configuration File 58
Configuration 6: Multiple JADE Servers 59
Configuration 6 - JadeHttp.ini File 60
Configuration 6 - Web Application Configuration File 60
Configuration 7: Multiple Web Servers 61
Configuration 7 - JadeHttp.ini File 61
Configuration 7 - Apache Configuration File 61
Configuration 7 - Web Application Configuration File 62
WebApps - 2018.0.01
Before You Begin
The JADE Web Application Guide is intended as a main source of information when you are developing,
administering, and implementing Web JADE applications; that is, JADE forms, HTML documents, Web services,
and REST services.
Related Documentation
Other documents that are referred to in this guide, or that may be helpful, are listed in the following table, with an
indication of the JADE operation or tasks to which they relate.
WebApps - 2018.0.01
Web Application Guide
Conventions
The JADE Web Application Guide uses consistent typographic conventions throughout.
Convention Description
Arrow bullet ( ) Step-by-step procedures. You can complete procedural instructions by using either
the mouse or the keyboard.
Bold Items that must be typed exactly as shown. For example, if instructed to type foreach,
type all the bold characters exactly as they are printed.
File, class, primitive type, method, and property names, menu commands, and dialog
controls are also shown in bold type, as well as literal values stored, tested for, and
sent by JADE instructions.
Italic Parameter values or placeholders for information that must be provided; for example,
if instructed to enter class-name, type the actual name of the class instead of the
word or words shown in italic type.
Italic type also signals a new term. An explanation accompanies the italicized type.
Document titles and status and error messages are also shown in italic type.
Blue text Enables you to click anywhere on the cross-reference text (the cursor symbol
changes from an open hand to a hand with the index finger extended) to take you
straight to that topic. For example, click on the "Handling Events on Web Pages"
cross-reference to display that topic.
Bracket symbols ( [ ] ) Indicate optional items.
Vertical bar ( | ) Separates alternative items.
Monospaced font Syntax, code examples, and error and status message text.
ALL CAPITALS Directory names, commands, and acronyms.
SMALL CAPITALS Keyboard keys.
Convention Description
KEY1+KEY2 Press and hold down the first key and then press the second key. For example,
"press Shift+F2" means to press and hold down the Shift key and press the F2 key.
Then release both keys.
KEY1,KEY2 Press and release the first key, then press and release the second key. For example,
"press Alt+F ,X" means to hold down the Alt key, press the F key, and then release
both keys before pressing and releasing the X key.
WebApps - 2018.0.01
Chapter 1 Implementing Web Applications
Overview
Generating HTML
Message Logging
Overview
The HTML thin client mode enables you to use the Internet to access your JADE applications. Web browsers, such
as Microsoft Explorer, provide a convenient client interface to JADE data on distributed servers.
WebApps - 2018.0.01
Web Application Guide
The JADE development environment enables you to create Web pages. You can create a JADE application
in one complete graphical environment, and deploy this application on the Web. HyperText Markup
Language (HTML) code is generated automatically.
Session management
JADE creates a session for each user who accesses a JADE application from an HTML thin client. The
TCP/IP communications protocol is used to access JADE applications from the Internet through a Web
server.
JADE enables you to import external HTML files by using a JADE development environment wizard.
Corresponding classes and properties are created for each HTML file that is imported. For details, see
"Adding and Maintaining HTML Documents", in Chapter 12 of the JADE Development Environment User’s
Guide.
Web browsers
The dynamically generated HTML code enables you to generate a single user interface that is compatible
with multiple browsers (that is, with any browser that is compliant with HTML 3.2).
Web server
The Microsoft Internet Information Server (IIS) or the Apache HTTP Server is used as the Web server.
The HTTP or HTTPS communication protocol is used to send and receive messages between the Internet
and a Web server for Web services, REST services, and Web-enabled applications.
The connection between the JADE Web application and the jadehttp module can be over TCP/IP or a
named pipe. When running JADE in HTML thin client mode using a named pipe, your JADE application and
IIS must reside on the same workstation. When using a TCP/IP connection, the machine hosting IIS or
Apache HTTP Server can be different from the machine that is running the JADE application, to provide
greater security via firewalls.
If you are uploading images from another machine for a JADE Web-enabled form over a TCP/IP connection,
the Firewall parameter in the [Jadehttp Files] section of the JadeHttp initialization file or the Firewall
configuration directive in the JADE mod_ jadehttp module and the Firewall parameter in the [WebOptions]
section of the JADE initialization file must both be set to true.
Notes The TCP protocol for direct Web services communication works only between JADE systems.
For direct Web services, the machine name must contain the machine name or the IP address followed by a
colon (:) character then by a TCP port number on which this service is offered.
JADE clients
The user interface for a standard (fat) JADE client can be the same as that defined for an HTML thin client, or
it can be different, enabling you to have one object model but with different views of that model. The JADE
clients can run Web-enabled applications, Web services, and REST services.
WebApps - 2018.0.01
Web Application Guide
Security
Operating system security and IIS or Apache HTTP Server security for data access
For details, see "Internet Access Support", in Chapter 2 of the JADE Object Manager Guide.
To ensure that an application specified in a Web browser cannot cause an attachment to a non-JADE
environment within a Windows operating system, you must specify the name of the Web application to which
users can connect as a section name within the jadehttp.ini file, as follows.
[application-name]
An attempt to attach to an application is made only to the applications whose names are specified as section
names in the jadehttp.ini file.
For details about the paths that the jadehttp library file derives for files, see [Jadehttp Files] Section" under
"Configuring JadeHttp for Remote Connections", in Chapter 2 of the JADE Installation and Configuration
Guide. See also "Configuring JadeHttp for Remote Connections" and "Controlling the Location of Files
Uploaded via a Web Application" under "Configuring Your JADE Software", in Chapter 2 of the JADE
Installation and Configuration Guide.
Tips If you want to restrict the number of Web-enabled, Web services, or REST services applications, you can
set the LimitPortRange parameter in the [WebOptions] section of the JADE initialization file to true. This prevents
applications from using a port number that exceeds the starting port number plus the number of copies of the
application. When you set this parameter to true, an application cannot be started when the port limit is exceeded,
and a message is output to the jommsg.log file.
If you want to change the number of seconds after which Web-enabled, Web services, or REST services
applications wait for message transfers to complete before timing out, specify the ReadTimeout parameter in the
[WebOptions] section of the JADE initialization file with the appropriate number of seconds. The default value is
600 seconds (10 minutes) but you can specify this parameter and set it to zero (0) if you do not want the
application to time out waiting for message transfers to complete. (You can prefix this parameter with the name of
the application if you want different applications to have different message transfer timeout values.)
As HTML does not allow for exact placement of controls nor the exact width and height, forms painted for the
Internet are not "what you see is what you get" (WYSIWYG). Your HTML-generated page may therefore look
different from your painted form. Experimentation and experience will enable you to design your forms to achieve
the best results.
The paint event is not called when running a Web-enabled JADE application, as no JADE forms are created and
displayed. Your Web page may look different from your painted form for the following reasons.
The JADE Painter allows the exact placement of controls, but HTML does not. HTML tables are used
extensively to try to place controls.
In HTML, font sizes are specified as being between sizes 1 and 7, whereas there is greater control over font
sizes in JADE. This requires a mapping of font sizes.
WebApps - 2018.0.01
Web Application Guide
The actual width of input items (for example, combo boxes) is dependent on the content and cannot be
controlled using HTML. Other controls, while giving some level of flexibility, also fall into the same category.
Tip Ultimately, the layout of the Web page is determined by the Web browser. The same form can therefore look
different in two different browsers. Even a Web-specific painter cannot always accurately generate HTML to reflect
what has been painted. For this reason, keep your Web forms simple and always check the output against the
Web browsers in which you expect your application to be used.
To reduce the amount of memory being used by Web sessions, JADE creates a physical window only for Ocx,
OleControl, ActiveXControl, and MultiMedia controls and a form only if an Ocx, OleControl, ActiveXControl, or
MultiMedia control is created. In most cases, the Window class hwnd method returns a null value unless a
physical window or a form is created for an Ocx, OleControl, ActiveXControl, or MultiMedia control.
For report-type Web pages, the writeHTML method of the Frame class functions like the print method of the
Printer class, except that HTML code is generated instead of output being directed to the printer or print preview
when a Web session is active. If there is no active Web session, the behavior is that of the print method (that is,
output is directed to the printer or print preview).
The New Form dialog is then displayed, to enable you to define your Web page.
2. Specify a form name in the Form Name text box. You must specify a form name, which cannot be the name
of another class in the current schema. The form name can be no longer than 29 characters. It can include
numbers and underscore characters, but cannot include punctuation or spaces. The first letter of the name is
converted to an uppercase character, if it is lowercase.
4. In the Form Style group box, select the Web option button. The JADE Painter switches to a mode that
supports HTML-style windows. The grid is automatically set to support character mode painting (that is,
snap-to-grid, with grid coordinates of 8 by 20 pixels for a 640 by 480 pixel display).
5. Click the OK button. Alternatively, click the Cancel button to abandon your selections.
WebApps - 2018.0.01
Web Application Guide
In addition to the Painter controls listed under "Generating HTML", later in this chapter, the Web controls listed in
the following table are also provided. (For details, see Chapter 2 of the JADE Encyclopaedia of Classes.)
The following controls are not supported on Web pages, and are ignored in the HTML generation process.
Browse buttons
OLE control
Progress bar
Tip Use the Table class borderStyle property setting of BorderStyle_None if you want to turn off the display of
borders around tables on your Web pages.
Generating HTML
The generation of your HTML code starts when the show method of a form is called or the start-up form is initiated,
as follows.
1. The load method of the form is invoked. This method must set up all required information in the controls; for
example, a combo box must be populated.
2. When the load process has completed, the HTML generation is started. This generation creates a string
containing HTML text.
3. The string of generated HTML text is then returned to the Web browser, which displays the information.
See also "Adding and Maintaining HTML Documents", in Chapter 12 of the JADE Development Environment
User’s Guide.
For details, see Chapters 1 and 2 of the JADE Encyclopaedia of Classes. For a summary, see the following
subsections.
WebApps - 2018.0.01
Web Application Guide
Application::webMinimumResponseTime Property
The Application class webMinimumResponseTime property is summarized in the following table.
Property Description
webMinimumResponseTime Contains the maximum time (in seconds) that a Web browser user waits before
a response must be sent back to that browser user
This property can be set dynamically at run time or you can set it in the JADE development environment by using
the Minimum Responses Time text box in the Web Options sheet of the Define Application dialog.
Method Description
executeMethodNotFoundMessage Returns a default HTML string to a Web browser user when the
method specified for execution cannot be found or it is invalid
createSessionErrorMessage Returns the message displayed on Web browsers when a Web
session cannot be created
getCurrentSession Returns a reference to the WebSession object of the specified Web
session identifier
getCurrentSessionId Returns a string of up to 16 characters that identifies the current Web
session
getSessionTimeout Returns the Web session timeout value specified for the application
htmlPageNotFoundMessage Returns the error message that is sent to the receiver when the
requested page for the Web application is not found
invalidWebSessionMessage Returns an HTML string that is to be displayed on the Web browser
when a session is invalid
licencesExceededMessage Returns the message that is displayed on Web browsers when your
licences have been exceeded
minimumResponseTimeExceededMsg Returns a default HTML string to a Web browser user when the
maximum wait time or a response is exceeded
removeSessionMessage Returns the message that is displayed on Web browsers when your
Web session ends
setSessionTimeout Dynamically sets the period in minutes at which the Web session
ends if no requests have been received within that time
setStatusLineDisplay Dynamically changes scrolling text displayed in the Web browser
status line
timedOutSessionMessage Returns the message that is displayed on Web browsers when your
Web session times out
WebApps - 2018.0.01
Web Application Guide
Method Description
allowWebPrinting Enables you to set the allow parameter to true so that Microsoft Internet Explorer 4 and
higher Web browsers generate slightly different code. (This parameter is set to false, by
default.)
Setting the allow parameter to true for these Web browsers enables the correct printing
of the contents of the Web page when the Print command is selected in the Web
browser File menu. The requirement of this setting is content-dependent (for example,
sometimes Internet Explorer 5.5 or higher may not print segments or pages of the
displayed Web page because of the way that Internet Explorer handles the style sheet
settings).
generateHTML Generates the HTML string for the form, which can be subsequently manipulated before
being sent back to the Web browser. It can also be saved as a file to obtain a snapshot
and this file can then be periodically updated (using notifications, for example). This
helps reduce generation and Graphics Device Interface (GDI) overhead in situations
where the data seldom changes or it is not necessary to have the most current data
available.
When the generateHTML method is called to generate an HTML string, the HTML is
generated without word wrapping when the wordWrap property is set to the default
value of false. Set this property to true if you want an HTML string in a table cell
generated with word wrapping.
generateHTMLStatic Generates the static HTML string for the form and builds the full Uniform Resource
Locator (URL) action line using the specified Web server machine name, virtual
directory on the Web server, and protocol for transmitting data (for example, HTTP or
HTTPS).
Method Description
browserType Returns a string containing the type of Web browser.
createVirtualDirectoryFile Passes image files created by a JADE application to the JadeHttp library or
JADE mod_jadehttp module.
deleteVirtualDirectoryFile Deletes specified files from the virtual directory used by the jadehttp library.
WebApps - 2018.0.01
Web Application Guide
Method Description
getHttpParam Returns the value associated with the specified HyperText Transfer Protocol
(HTTP) parameter.
getHttpString Returns the HTTP string that is returned from the Web browser.
getServerVariable Returns the HyperText Transfer Protocol (HTTP) header information for your
Web request from the Web server (that is, Microsoft Internet Information Server
(IIS) or Apache HTTP Server).
getSessionForm Keeps track of all open form instances in the current session in a Web-enabled
application that uses JADE forms.
getWebSessionCount Returns the total number of active Web sessions for all nodes connected to the
JADE server.
isVDFilePresent Returns whether the requested file is present on the Web server side of the
firewall when using the JADE Web interface via the jadehttp library file or the
JADE mod_jadehttp module.
processRequest Executed when a request is received from the Web. The appropriate form is
then updated with the information received from the incoming string and a
reply is sent back to the Web browser after all processing is complete.
removeSession Removes the current Web session.
removeSessionWithMessage Enables you to remove the current Web session and send the specified
message.
reply Executed when all processing is complete and the JADE system is ready to
send a response back to the Web browser.
setCurrentLocale Dynamically sets the current locale to the specified value.
Window::userScript Property
The Window class userScript property is summarized in the following table.
Property Description
userScript String containing set up scripts that are to be included as part of the HTML generation.
Method Description
addWebEventMapping Adds functions to be invoked when a specified event occurs
clearWebEventMappings Removes all Web event mappings for a specified window
getWebEventMappings Returns all of the Web event mappings for a specified window
removeWebEventMapping Removes the specified event for window
WebApps - 2018.0.01
Web Application Guide
Method Action
show Executes the load method, generates the HTML, and returns the HTML to the Web server.
showModal Not supported, and generates an error at run time or actions the show method. (For details, see
"Enabling Your JADE Application for HTML Thin Client Access", later in this chapter.)
unloadForm Removes the form from the Web session list of open forms.
webBrowserAutoRefreshInterval property, to specify the number of seconds after which the Web page is
automatically refreshed and when that property is set to a non-zero value.
The default value of zero (0) for the automatic refresh interval indicates that the Web page does not refresh
automatically. If you specify an automatic refresh interval and you do not specify the URL to invoke when the
number of seconds is reached, control is returned to the JADE application.
webBrowserAutoRefreshURL property, to specify the URL to invoke when the automatic refresh interval is
reached.
webBrowserDisableBackButton property, to specify whether the currently displayed Web page refreshed
instead of displaying the previous page when the user clicks the Web browser Back button. As it is not
possible to disable the Back button or the menu item from scripting, set this property to true if you want to
prevent the user from going to a previous Web page.
If a click event is present, the generated HTML sets up the Uniform Resource Locator (URL) to cause a click
event on the control to send a request back to the JADE application.
No other event is processed, unless it is explicitly called from the click event method.
WebApps - 2018.0.01
Web Application Guide
Notes Because of HTML restrictions, the click event cannot be executed for text box controls. Excessive use of
the click event significantly slows HTML thin client interaction, as each event is passed back to the JADE
application for processing.
The paint event is not called when running a Web-enabled JADE application, as no JADE forms are created and
displayed.
Events are supported only on Web pages accessed by using Internet Explorer 4.0 (or higher).
The transient RootSchemaSession class provides the protected allowHiddenControlEvents property, which
specifies whether hidden controls on Web pages can invoke event methods. As this property is false by default,
set it to true to specify that event methods can be invoked by hidden controls.
For details about handling supported event methods in controls on Web pages, see "Enabling Event Handling on
Web Pages", later in this chapter.
When a request is sent to the JADE application, the Web browser waits for a reply. If the JADE code that is
processed does not initiate the creation of another Web page, the form that was previously displayed and not
unloaded is displayed again. If there were no previous forms, the start-up form is displayed so that the Web
browser does not wait indefinitely for a response.
For more details about the Define Application dialog, see "Defining Applications", in Chapter 3 of the JADE
Development Environment User’s Guide.
Select the Applications command from the Browse menu, or press Ctrl+L
2. From the Application menu of the Application Browser, select the Add command to add a new application to
your current schema or the Change command to enable HTML thin client access or to maintain the
preferences of your current application.
3. Select the Web-Enabled or Web-Enabled Non-GUI option in the Application Type combo box, to specify that
the application can be accessed from the Web using an HTML thin client. The Web Options sheet is then
enabled.
WebApps - 2018.0.01
Web Application Guide
The start-up form defined for the application is the first Web page that is displayed when the application is
invoked from a Web browser. Application features such as Multiple Document Interface (MDI) forms and
three-dimensional controls are ignored for HTML-enabled applications.
In addition, as applications of type Web-Enabled Non-GUI do not display the Web Application Monitor
window, this type of application can be run in the background.
The Web Options sheet is then displayed. Now that you have enabled your application for HTML thin clients, you
can specify your access options.
Tip Use the currentSession system variable in a JADE method to determine if a transaction is from another
workstation or from an HTML thin client. The currentSession system variable is set to null if there is no current
Web session.
For details, see "System Variables", in Chapter 1 of the JADE Developer’s Reference. See also Chapter 12 of the
JADE Development Environment User’s Guide, "Adding and Maintaining HTML Documents".
WebApps - 2018.0.01
Web Application Guide
For more details about the Define Application dialog, see "Defining Applications", in Chapter 3 of the JADE
Development Environment User’s Guide. For details about defining a Web services application, see "Defining a
Web Services Provider Application", in Chapter 11 of the JADE Developer's Reference. For details about defining
a REST services application, see "Defining a REST Service Application", in Chapter 11 of the JADE Developer's
Reference.
1. In the Connection Name text box, specify the appropriate TCP/IP address in the format
TCP-address:port-number (for example, 143.67.78.90:6014).
WebApps - 2018.0.01
Web Application Guide
Tip If you want to get the IP address, call the WebSession class getServerVariable method to return the IP
address of the current Web session as determined by the Web server, as follows.
currentSession.getServerVariable('REMOTE_ADDR');
For details about using the ConnectionName parameter in the [WebOptions] section of the JADE
initialization file, see your JADE Initialization File Reference.
Note The connection name defaults to the application name. (The application name is displayed in the title
bar of the Web Application Monitor window.) If you have more than one application with the same name,
specify a unique name to identify the connection. The connection name can include any character or number
in the ranges A through Z, a through z, or 0 through 9. The first character must be uppercase.
2. In the Application Copies text box, specify the maximum number of copies that you require for your HTML
thin client application. When the HTML thin client application starts, the number of copies specified in this
text box are started. The default value is 1. You can specify a maximum of 62 copies, which is a
Windows-imposed limit.
Note All application copies use the same port number. If you specify 6014 as the starting port number in
the Connection Name text box and specify three in the Application Copies text box, the application copies
use port numbers 6014, 6015, and 6016.
For details about using the ApplicationCopies parameter in the [WebOptions] section of the JADE
initialization file to specify or change the number of copies of the application to start up, see your JADE
Initialization File Reference.
3. In the Session Timeout text box, specify the period in minutes at which the Web session is to end if no
requests have been received within that time. The default value of zero (0) indicates infinity; that is, you do
not want your Web session to time out.
The Application class getSessionTimeout and setSessionTimeout methods enable you to get and
dynamically set the current Web session timeout value, respectively.
4. In the Minimum Response Time text box, specify the maximum time (in seconds) that a Web browser user
has to wait before a response must be sent back to that user from the JADE application, triggered by a timer
event.
By default, requests do not time out; that is, the default value of zero (0) indicates infinity.
When the timer event occurs, a default message is sent back to the browser and the current request is
terminated. You can override the default message that is sent to the browser user by reimplementing the
Application class minimumResponseTimeExceededMsg method in the Application subclass of your
user-defined schema.
You can also set the minimum response time value dynamically at run time, by setting the Application
subclass webMinimumResponseTime property in your logic.
5. Check the Disable Messages check box to specify that your Web session messages are not displayed in a
message box on your client workstation; for example, in a confirmation dialog when the Web session is shut
down.
By default, message boxes are enabled; that is, this check box is unchecked. Regardless of the setting of this
parameter, any message that is raised is displayed in the Web Application Monitor window.
6. If you selected the HTML Documents option button on the Application sheet of the Define Application dialog
(that is, you want HTML generated based on HTML documents in your Web application), the HTML
Documents sheet on the Web Options sheet is enabled. (For details about the Applications sheet, see
WebApps - 2018.0.01
Web Application Guide
a. In the Machine Name text box, specify the physical location to be used when generating the HTML for
the JadeHTMLClass class buildFormActionOnly and buildLink methods.
b. In the Virtual Directory text box, specify the Uniform Resource Location (URL) to be used when
generating the HTML for the JadeHTMLClass class buildFormActionOnly and buildLink methods.
For details about using the URLSpecifications parameter in the [WebOptions] section of the JADE
initialization file to specify Internet server virtual directories for HTML documents for all of your
Web-enabled applications or for a specific Web-enabled application, see the JADE Initialization File
Reference.
c. Use the Home Page combo box to select the HTML home page that is to be the start-up page when
you run your Web-enabled application. (If you do not select a home page, an error is displayed when
you click the OK button on the Define Application dialog.)
See also "Adding and Maintaining HTML Documents", in Chapter 12 of the JADE Development Environment
User’s Guide.
7. If your Web application uses JADE forms from which you want HTML dynamically generated and you did not
change the default value of JADE Forms in the Web Application Type group box on the Application sheet of
the Define Application dialog, specify your Web application form options on the JADE Forms sheet.
Note The JADE Forms sheet is enabled only when your application does not use HTML documents; that
is, you selected the form that is to be displayed when the new application is started in the Start-up Form
combo box on the Application sheet of the Define Application dialog and you did not change the default
Web application type of JADE Forms.
a. In the Virtual Directory text box, specify the Uniform Resource Location (URL) if you want your images
and Java applets located in a directory other than the working directory of the JADE application. There
is no default base URL. If you do not specify a URL in this text box, the virtual directory specified in the
Microsoft IIS is used as the URL.
When setting up IIS for JADE, you must specify a virtual directory and the physical location of this
directory. By default, the virtual directory is used as a work area for generating image files.
If the Base URL is set up, the generated HTML code uses this URL to set up locations for these files,
rather than the default work area.
To enable JADE to determine the physical location of this base URL, you must also specify the physical
directory in the Physical Directory text box. To create the physical directory, click the Create button. In
IIS, this physical directory must be set up as a virtual directory, by using the base URL that you specify
in this text box.
The VirtualDirectory parameter in the JADE initialization file [WebOptions] section enables you to
specify a location for your images and Java applets other than the working directory specified in this
text box, if required. (For details, see "Web Options Section [WebOptions]", in the JADE Initialization File
Reference.)
For details about using the URLSpecifications parameter in the [WebOptions] section of the JADE
initialization file to specify Internet server virtual directories for HTML documents for all of your
Web-enabled applications or for a specific Web-enabled application, see the JADE Initialization File
Reference.
b. In the Physical Directory text box, specify the name of the physical working directory for your
WebApps - 2018.0.01
Web Application Guide
The PhysicalDirectory parameter in the JADE initialization file [WebOptions] section enables you to
specify a physical directory to override the working directory specified in this text box, if required. You
can specify multiple physical directories in the same JADE initialization file. For details, see "Web
Options Section [WebOptions]", in the JADE Initialization File Reference.
Note This parameter, which is used to generate images for the Web, applies only to Web-enabled
(that is, HTML-enabled) applications and not to Web services or REST services applications.
c. In the Maximum HTML Size text box, specify the maximum size in K bytes of the HTML string that can
be generated before stopping the generation. Although you can specify 99,999K bytes as the size of
the maximum HTML string, this would have a considerable impact on performance.
The optimum HTML string size is dependent on the available memory of both your Internet and your
JADE server. 30K bytes is a recommended maximum string size.
If the specified maximum HTML string is generated, the HTML generation is then stopped and the
partially generated string is returned to the Internet browser with the following message appended to
the string.
The default value of zero (0) specifies that there is no maximum HTML size.
d. In the Scrolling Text text box, specify the text that you want to scroll across the bottom of your Web
page, if required. By default, no text is scrolled across a Web page.
e. Check the Treat showModal as show check box to display Web pages in the application by using the
show method if the showModal method is encountered in your code. (The show method executes the
load method, generates the HTML, and then returns the HTML to the Web server.)
As the showModal method is not supported, by default an error is raised at run time if the showModal
method is encountered.
f. Check the Cross Browser Compatibility check box to specify the version of HTML code that JADE
generates for your Web sessions. Check this box if you want compatibility across browsers for your
JADE Web sessions; that is, identical HTML code is generated for both Netscape and Internet Explorer.
By default, different HTML code is generated for Internet Explorer 4.0 (that is, this check box is
unchecked).
g. Check the Form Style Display (IE 4) check box to specify that your Web pages are displayed as
windows (that is, with captions and borders) when using Internet Explorer 4.0. By default, your JADE
forms are displayed as Web browser pages (that is, this check box is unchecked).
h. Click the Web Events button on the JADE Forms sheet if you want to specify the handling of:
The click event method in check box, combo box, list box, table, and option button controls on
Web pages, and in your user-defined subclasses of those five controls types only.
The sheetChg event method in folder controls and your user-defined folder control subclasses.
Note Events are supported on Web pages only when using Microsoft Internet Explorer 4.0 or higher.
The Web Events dialog is then displayed. For details, see "Enabling Event Handling on Web Pages",
later in this chapter.
WebApps - 2018.0.01
Web Application Guide
8. Click the OK button. Alternatively, click the Cancel button to abandon your selections.
For details about implementing a TCP/IP connection to your JADE applications, see "Connecting to JADE
Applications from Internet Information Server (IIS)", in Chapter 2 of the JADE Installation and Configuration Guide.
Tips If you want to restrict the number of Web-enabled, Web services, or REST services applications, you can
set the LimitPortRange parameter in the [WebOptions] section of the JADE initialization file to true. This prevents
applications from using a port number that exceeds the starting port number plus the number of copies of the
application. When you set this parameter to true, an application cannot be started when the port limit is exceeded,
and a message is output to the jommsg.log file.
If you want to change the number of seconds after which Web-enabled, Web services, or REST services
applications wait for message transfers to complete before timing out, specify the ReadTimeout parameter in the
[WebOptions] section of the JADE initialization file with the appropriate number of seconds. The default value is
600 seconds (10 minutes) but you can specify this parameter and set it to zero (0) if you do not want the
application to time out waiting for message transfers to complete. (You can prefix this parameter with the name of
the application if you want different applications to have different message transfer timeout values.)
When you are using Internet Explorer 4.0 (or higher) for your HTML thin client applications, you can enable:
The click event for the list box, combo box, option button, table, and check box controls or your user-defined
subclasses of those five control types only.
The conditions that must be satisfied to enable the click event for controls displayed on Web pages are as
follows.
Browser compatibility mode must be turned off, by ensuring that the Cross Browser Compatibility
WebApps - 2018.0.01
Web Application Guide
check box on the Web Options sheet of the Define Application dialog is unchecked.
The sheetChg event method in folder controls and your user-defined folder control subclasses.
1. In the list box, select the control or controls for which the applicable click or sheetChg event is to be enabled
on Web pages. (By default, these events are not supported on the controls on Web pages.)
If you have subclassed any of these controls in your JADE application, those subclasses are also listed to
enable you to support the appropriate event on your user-defined controls.
2. Click the OK button. Alternatively, click the Cancel button to abandon your selections.
For details about generating HTML code that is compatible across browsers for your JADE Web sessions (that is,
identical HTML code is generated for both Netscape and Internet Explorer), see "Specifying Your HTML Thin
Client Access Options", earlier in this chapter. See also "Form Class Methods" under "Enhanced Web
Functionality", earlier in this chapter, for details about the allowWebPrinting method.
_executeMethod=class-name::web_method-name
Note When you invoke a user method that bypasses the standard processing loop, your method name must
consist of the web_ name prefix.
For example, if the http string is like that shown in the following example, the web_generateXML method in the
Transaction class will be executed, passing the http string as a parameter.
http://persephone/jade/jadehttp.dll?MyWebApp&_executeMethod=Transaction::web_
generateXML&TransactionType=CashOnly
The method that is executed must return a primitive type, which is converted to a Binary primitive type before
being sent back to the Web browser. It is expected that the method will return a String value. In a Unicode JADE
system, the contents of the returned string are converted from Unicode to UTF-8 before being sent back to the
Web browser.
WebApps - 2018.0.01
Web Application Guide
If the method does not exist or the return type is invalid, a default message is sent back to the Web browser. To
override this message, you can reimplement the executeMethodNotFoundMessage method in the Application
class of a user-defined schema.
The jadehttp library file, supplied with JADE on the release medium and located on your Internet server, is
directly called by the Web server for each HTML client request that is made. This library connects to a JADE
client node by a named pipe or a TCP/IP connection.
The jadehttp library file sends the received request over the channel to the JADE application, which
processes the request and then returns an HTML page for transmission to the HTML thin client user.
When the library opens the other end of the channel, JADE waits for input from the library. When input
arrives, JADE processes that input and then sends the reply back to the library. JADE then waits for more
input.
As JADE asynchronously waits for input from the named pipe or TCP/IP, the JADE client node can perform other
tasks when it is idle; for example, monitoring and displaying the system processing status.
Connections from the jadehttp module and JADE Web application can be over TCP/IP or a named pipe
connection. JADE systems use the named pipe connection by default. For details about specifying that the HTML
generation for Netscape and Mozilla browsers is similar to that for Internet Explorer, see the
UseHTML4ForNetscape parameter in the [WebOptions] section of the JADE initialization file, in the JADE
Initialization File Reference.
Note The main advantage of a TCP/IP connection over a named pipe connection is that the machine hosting IIS
or Apache HTTP Server can be different from the machine that is running the JADE application, to provide greater
security via firewalls. A TCP/IP connection is also slightly faster than a named pipe connection and an Apache
HTTP Server cannot connect over a named pipe.
For details, see "Connecting to JADE Applications from Internet Information Server (IIS)", in Chapter 2 of the JADE
Installation and Configuration Guide.
WinHTTP and WinINet are operating system libraries that perform lower-level network communications. WinINet
proxy settings are set the same way as proxy settings for Internet Explorer (that is, by using the Internet Options
dialog accessed from the Control Panel).
For details about setting Internet proxy settings, see Microsoft documentation. WinHTTP proxy settings are
configured using the netsh.exe tool. To obtain help, specify the following command.
See also the EnableWinHTTP and EnableWinINET parameters in the [JadeEnvironment] section of the JADE
initialization file. If you set both parameters to true, WinHTTP is used in preference. If you set both parameters to
false, the support of both protocols is disabled and a Web service consumer can use only the JADE Direct
scheme; that is, jadehttp.tcp.
WebApps - 2018.0.01
Web Application Guide
The last access timestamp determines the disconnect status. If there is no activity for the session for the period of
time specified in the Session Timeout text box of the Define Application dialog, the session is terminated. If you
transmit a request after the specified timeout period, you are informed that the Web session has timed out, you
must reconnect to the JADE application, and then sign on again.
You can reimplement the Application::createSessionErrorMessage method if you want to display a different
session error message on the Web browser when a Web session cannot be created. The returned string should
be in HTML format, for correct rendering on the browser.
By default, this application opens an instance of the NamedPipe or JadeInternetTCPIPConnection class with the
name of the JADE application as its name, and waits for the jadehttp library to connect to the other end of the pipe
or TCP/IP. When the pipe or TCP/IP is connected, it waits for HTML client requests to be sent over the pipe or
TCP/IP. For details about implementing a TCP/IP connection, see "Connecting to JADE Applications from Internet
Information Server (IIS)", in Chapter 2 of the JADE Installation and Configuration Guide.
When the first request for the JADE application is received, the IIS initiates the jadehttp library, and then calls the
GetExtensionVersion entry point in the library to obtain the Internet Server Application Programming Interface
(ISAPI) version that is being used. The library is initialized as part of this call, and it attempts to open a pipe or
TCP/IP connection by using the JADE server node name.
Note To process multiple HTML client requests simultaneously, run additional copies of the JADE application.
For details, see "Handling Multiple Copies of the JADE Program", in Chapter 1 of the JADE Installation and
Configuration Guide. Each copy of the JADE application opens its own instance of the named pipe. The jadehttp
library uses the additional pipe channels, as required. (By default, there are 10 pipe channels.)
If the connected JADE application terminates and breaks a pipe or TCP/IP channel, the library removes that pipe
or TCP/IP from the list of available channels. When the JADE application is restarted, the library reestablishes the
channel without any required intervention.
Web sessions are not closed when an application is terminated. They are closed only when the WebSession
class removeSession method is called, a session timeout specified in the Session Timeout text box on the Web
Options sheet of the Define Application dialog occurs (for details, see "Specifying Your HTML Thin Client Access
Options", earlier in this chapter), or when all of the Web-enabled applications terminate normally.
WebApps - 2018.0.01
Web Application Guide
1. The TCP/IP address and the contents of a hidden field containing the encrypted session identifier are
obtained from the input data.
2. The TCP/IP address and the encrypted session identifier are used to search the session dictionary for an
existing session object for the client. If the entry is not found in the dictionary, a new client session object is
created.
3. A processRequest method of the WebSession class instance is then called, passing the request data to
JADE. This method processes the request, and sends a formatted HTML page back by the named pipe or
TCP/IP instance on which the input data was received.
The jadehttp library sends this page to the client, and the Web server is then informed that the request
processing is complete.
If you want to change the number of seconds after which Web-enabled applications wait for message transfers to
complete before timing out, specify the ReadTimeout parameter in the [WebOptions] section of the JADE
initialization file with the appropriate number of seconds. The default value is 600 seconds (10 minutes) but you
can specify this parameter and set it to zero (0) if you do not want the Web-enabled application to time out waiting
for message transfers to complete. (You can prefix this parameter with the name of the application if you want
different applications to have different message transfer timeout values.)
You can use the MaxMessageSize parameter in the [application-name] section of the jadehttp.ini file to specify
the maximum size allowed for a single-part Web message (that is, a single stream of data with minimal formatting)
if you want a value greater than 1,000,000 bytes. (For details, see "Configuring JadeHttp for Remote
Connections", in Chapter 2 of the JADE Installation and Configuration Guide.)
When you specify a maximum number of queued entries, any additional request received that would also be
queued when the maximum queued entries is reached will be rejected. The user will be sent the contents of a file
named busy.htm from the same directory as the jadehttp.ini file (as it is for the jadehttp.htm error file, described
in the following section).
If that file is not available, the following text response will be sent.
This request cannot be processed at this time due to heavy usage - please try again
shortly.
You can use the MinMessageSize parameter in the [application-name] section of the jadehttp.ini file or the
MinMessageSize directive in the Apache mod_ jadehttp.so library to specify the minimum size allowed for a Web
message received from JADE using the WebSession class reply method to send HTML string Web requests back
to the client node.
The minimum value is 1 byte, the maximum value 1024 bytes, and the default value 10 bytes. This value is read
the first time the specified application is accessed after jadehttp.dll has been loaded by Internet Information
Server (IIS) or it is read once, when the Apache Web server starts.
Message Logging
If communications cannot be established with the JADE system, a jadehttp.htm file is output, advising you that the
service is down. This file must be in the same directory as the jadehttp library file on the Internet server.
The jadehttp library file reads an initialization file called jadehttp.ini, located in the same directory as the library.
WebApps - 2018.0.01
Web Application Guide
A new log file is always opened after the jadehttp.dll library has been initiated rather than appending to the
existing log file. The current date and time is always added to the file name when a new file is created (when the
library is initiated or when a log file switch occurs). When a jadehttp.log log file reaches 1M byte, a new log file is
created.
For details about the parameters available in the [Jadehttp Logging] section of the jadehttp.ini file that enable you
to specify your message logging requirements during Web-enabled applications, see "[Jadehttp Logging] Section"
under "Configuring JadeHttp for Remote Connections", in Chapter 2 of the JADE Installation and Configuration
Guide.
Processing problems in the jadehttp library are logged to the jadehttp.log file, located in the same directory as the
library. Failures that occur result from the unavailability of the JADE system.
The IIS server logs all HTML client requests to its own log file. You should enable IIS logging, and set the option to
automatically start a new file each day. The jadehttp library file also records routine messages to the log when it is
initiated and closed, and when connections to the named pipe or TCP/IP channels are made and broken.
When the value is true, messages logged to the jadehttp.log file do not include any of the text sent or received
from the client, as this text could contain personal information, passwords, credit card details, and so on. Logged
messages then only acknowledges that a message has been received or sent, because it is not possible to
distinguish what is sensitive data and what is not.
1. The error is reported to the HTML thin client user, logged on the JADE client workstation and a message is
displayed to inform the JADE client.
3. The HTML thin client user is returned to the previous valid form.
You can reimplement the Application::createSessionErrorMessage method if you want to display a different
session error message on the Web browser when a Web session cannot be created.
Caution As there is no modal support with HTML thin client applications, any code following app.msgBox in
your JADE method continues to be executed.
WebApps - 2018.0.01
Chapter 2 Monitoring Your Web Sessions
Overview
Disabling Logging
Overview
When you run an HTML-enabled application, the JADE Web Application Monitor is automatically initiated on the
client node workstation on which the HTML-enabled JADE application is running.
If a client node has more than one active HTML-enabled application, a Web Application Monitor window is
displayed for each active application on that workstation.
Use the Web Application Monitor to view the status of Web sessions, open your default browser for Web services
applications, and to reset or close Web sessions.
When the Web Application Monitor is initiated, the window displays session sign on information, including:
Session id
Query string
The Web Application Monitor menu bar contains the menus listed in the following table.
Menu Description
File Administers your HTML-enabled application
View Controls the display of information in your Web Application Monitor window
Session Controls your Web session
Help Accesses the standard Common User Access (CUA) help options
WebApps - 2018.0.01
Web Application Guide
The Web Application Monitor window is a multiple-line text window that logs and displays Web session
information. Information is appended to the window display with each user request and new session interaction,
as shown in the following image.
Note You can change the font name and size for the Web Application Monitor window by using the Editor sheet
of the Preferences dialog, accessed from the Preferences command in the Options menu of browse windows in
the development environment.
Use the scroll bar to scroll up and down the displayed HTML thin client information, if required.
When you exit from the HTML-enabled application, the Web Application Monitor window is closed, and all
displayed information is purged.
For details about running the JADE Monitor that provides system instrumentation and diagnosis, see Chapter 2,
"Using the JADE Monitor for System Instrumentation and Diagnosis", in the JADE Monitor User’s Guide.
Select the Open Browser command from the Web Application Monitor File menu.
For details about Web services applications, see Chapter 11, "Building Web Services Applications", in the JADE
Developer's Reference.
WebApps - 2018.0.01
Web Application Guide
If any users are accessing the application at the time that you select the Exit command, a message dialog advises
you that there are active users and asks you to confirm that you want to exit from the application.
When you confirm that you want to exit, active users are disconnected when all current transactions have
completed and the application is then closed down.
Any user who then tries to access the application again is informed that the application has been shut down.
To control whether JADE logs the content of Web messages, use the LogMessageContent parameter in the
[WebOptions] section of the JADE initialization file. Alternatively, you can specify the XML logmessagecontent
parameter in the Web application configuration file; that is, the following configuration file parameter disables the
logging of message content.
<logmessagecontent>false</logmessagecontent>
When the LogMessageContent parameter in the [WebOptions] section of the JADE initialization file or the XML
logmessagecontent parameter in the Web application configuration file is set to true, any Web logging includes
the Query String = content and Http String = content output. When the value of the LogMessageContent
initialization file parameter or the XML logmessagecontent configuration file parameter is false, any Web logging
does not include this message content.
When you initiate the Web Application monitor and tracing is on, a message is displayed indicating the status of
the LogMessageContent parameter, as follows.
The message is also displayed if you turn logging on or off by toggling the Disable Logging|Enable Logging
command in the View menu of the Web Application Monitor window.
Note By default, the value of the DisableLogging parameter is false; that is, logging is enabled.
Disabling Logging
Select the Disable Logging command from the Web Application Monitor View menu to stop the display of
information in the monitor window. Web monitor information is logged to the window with each user request and
with new Web session information and statistics. For details, see "Displaying Session Details" and "Displaying
Session Statistics", later in this chapter, and "Monitoring Your Web Sessions", earlier in this chapter.
WebApps - 2018.0.01
Web Application Guide
When you have selected this command to disable the logging of information to the monitor window, the menu
command is toggled to the Enable Logging command.
Select the Enable Logging command to cause the redisplay of logging information.
Note The DisableLogging parameter in the [WebOptions] section of the JADE initialization file specifies whether
logging in enabled in the JADE Web Application Monitor window. This parameter is set to false by default. You
can set it to true if you want to stop the display of logging information in the monitor window (for example, when
you are running an application as a service and the Web Application Monitor window View menu item cannot be
used).
If the specified file name cannot be written to or it is not valid (for example, you did not specify an absolute path or
the specified path does not exist), a file called websession.log is created in the physical directory specified in the
Physical Directory text box for your JADE forms on the Web Options sheet of the Define Application dialog or in
the PhysicalDirectory parameter in the [WebOptions] section of the JADE initialization file. (For details about
defining the physical directory, see "Specifying Your HTML Thin Client Access Options", in Chapter 1.)
Note The physical directory, which is used to generate images for the Web, applies only to Web-enabled (that
is, HTML-enabled) applications and not to Web services or REST services applications.
The Session Id dialog is then displayed. Specify the required Web session identifier in the Enter Session Id text
box, and then click the OK button to force users to restart the session.
Tip Use the List command from the Session menu to list all current Web sessions in the Web Application
Monitor window. You can then view all current Web sessions, to determine the id of the session that you want to
restart.
When you have specified a valid session identifier, all session information relating to open forms is cleared; that
is, all currently open forms are unloaded.
The next HTML client request forces the user to the start-up form.
Closing a Session
Select the Close command from the Web Application Monitor Session menu to close a current Web session. The
Session Id dialog is then displayed.
Specify the required Web session identifier in the Enter Session Id text box and then click the OK button to force
the specified session to close down.
WebApps - 2018.0.01
Web Application Guide
Tip Use the List command from the Session menu to list all current Web sessions in the Web Application
Monitor window. You can then view all current Web sessions, to determine the id of the session that you want to
close.
Any further requests using this session identifier cause the user of the Web browser to be notified that the Web
session has ended.
The Session Id dialog is then displayed. Specify the required Web session identifier in the Enter Session Id text
box and then click the OK button to display information for that session.
Tip Use the List command from the Session menu to list all current Web sessions in the Web Application
Monitor window. You can then view all current Web sessions, to determine the id of the session whose information
you want to view.
Each HTML-enabled application has its own list of sessions. The following information is displayed for your
specified session.
IP address
Use the listed information to select the session that you want to specify in the Session Id dialog to display session
details, or to restart or close a Web session.
WebApps - 2018.0.01
Web Application Guide
Press F1
The JADE online help is then displayed; for example, the WebApps.pdf) document is displayed in Adobe Reader.
Use the functions available in JADE online help to find the required topics. For details, see "JADE HTML5 Online
Help" or "JADE Product Information Library in Portable Document Format", in Chapter 2 of the JADE Development
Environment User’s Guide.
If you have not specified an About form for your application, the JADE default About box is displayed. This dialog
displays the following information, and is for display purposes only.
Application name
Current year
When you use the JADE Painter menu designer to create a standard Help menu that contains an About menu
item, JADE displays a message box at run time if you do not set the Application class aboutForm property. This
message box displays the following information.
----------- Title:
"About Application: application-name"
----------- Contents:
Application: application-name
Release: application-release-property
WebApps - 2018.0.01
Chapter 3 Configuring Web Applications
Overview
Configuration 1: Minimum
Overview
You can use an XML-based configuration file to define runtime configurations for Web-enabled applications, Web
services consumers, and REST services applications. The advantages of using XML instead of standard
initialization file syntax are as follows.
Standards-based
If the [WebOptions] section in the JADE initialization file has a reference to the XML-based configuration file, the
settings in the XML-based configuration file are used. If not, the settings in the [WebOptions] section are used.
Note There are additional runtime configuration parameters that you can specify. These can be defined only by
using the XML format configuration file.
WebApps - 2018.0.01
Web Application Guide
You can define two types of configuration file: one for Web-enabled applications (JADE forms, HTML documents,
and Web service providers) and REST services applications, and one for Web service consumers.
For Web-enabled applications and REST services applications, the JADE initialization file setting required to
use the XML-based configuration file is as follows.
[WebOptions]
ApplicationConfigFile=file-name
For Web service consumers, the JADE initialization file setting required to use the XML-based configuration
file is as follows.
[WebOptions]
ConsumerConfigFile=file-name
For details about the ApplicationConfigFile and ConsumerConfigFile initialization file parameters, see the JADE
Initialization File Reference.
<?xml version="1.0"?>
<jade_config>
<application schema="" name="" id="">
<web_config>
<connection_name/>
<protocol_family/>
<application_copies/>
<session_timeout/>
<minimum_response_time/>
<disable_messages/>
<output_maximum_length/>
<log_file_name/>
<logmessagecontent/>
<disable_logging/>
<lock_retries/>
<prompt_on_shutdown/>
<firewall/>
<monitor_font/>
<base_uri>
<protocol/>
<machine_name/>
<virtual_directory/>
</base_uri>
<support_library/>
<jade_forms>
<physical_directory/>
<maximum_HTML_size/>
<scrolling_text/>
<show_modal/>
<cross_browser/>
<form_style/>
<use_html4/>
<web_events>
<control_name/>
WebApps - 2018.0.01
Web Application Guide
</web_events>
<image_type/>
<page_sequencing/>
</jade_forms>
<html_documents>
<home_page/>
<html_page_sequencing/>
</html_documents>
<web_services_provider>
<read_timeout/>
<use_session_handling/>
</web_services_provider>
</web_config>
</application>
</jade_config>
The empty XML elements represent parameters that you can configure; for example, you can configure the
<connection_name/> element with the value WebApp, by replacing the empty element with a non-empty
element, as follows.
<connection_name>WebApp</connection_name>
In addition, the application XML element has three empty attributes that you can configure.
jade_config element
The jade_config XML element is the root element for the document.
application element
The application XML element contains the following attributes.
name specifies the name of the Web-enabled application to which the settings apply
id specifies an identifier string that enables copies of the same Web-enabled application to run with different
configuration parameters
The application type can be a JadeForms application, an HTMLDocuments application, a WebServices provider
application, or a RestServices application. For details, see "Connecting to JADE Applications from Internet
Information Server (IIS)" or "Connecting to JADE Applications from an Apache HTTP Server", in Chapter 2 of the
JADE Installation and Configuration Guide.
You can repeat the application element to specify configuration information for a number of applications. The
special name global is used for configuration information that applies to all applications.
In the following example, there is configuration that applies globally to all applications, specific configuration
information for WebApp1, and specific configuration information for WebApp2.
<?xml version="1.0"?>
<jade_config>
WebApps - 2018.0.01
Web Application Guide
The id attribute is used to enable the same application to be run with different configuration settings. In the
following example, the WebApp application can be run with the id="200" configuration settings or the id="300"
configuration settings.
<?xml version="1.0"?>
<jade_config>
<application schema="WebAppSchema" name="WebApp" id="200">
// configuration info specific to WebApp run with id "200"
</application>
<application schema="WebAppSchema" name="WebApp" id="300">
// configuration info specific to WebApp run with id "200"
</application>
</jade_config>
The following shortcut runs the WebApp application with the id="300" configuration settings.
web_config element
The web_config XML element is the root element for the general Web-enabled application settings.
connection_name element
The connection_name XML element specifies the name of a named pipe name or the TCP/IP address of the host
system. The TCP/IP address is of the form host:port number, as shown in the following example.
<connection_name>168.212.226.204:50000</connection_name>
application_copies element
The application_copies XML element specifies the number of copies of the application to start up on initiation.
The default value is 1.
In the following example, five copies of the application would be started up. All copies would use the same IP port
number, as specified in the connection_name element.
<application_copies>5</application_copies>
protocol_family
The protocol_family XML element specifies the TcpIp scheme that the Web server uses. The allowed values are
TcpIP, TcpIPv4, TcpIPv6, or TcpIPAny. (TcpIp is a synonym for TcpIpAny.)
WebApps - 2018.0.01
Web Application Guide
session_timeout element
The session_timeout XML element is the period in minutes after which a Web session is deleted if there has
been no activity for that session. The default value of zero (0) indicates that the session does not time out. This
setting is ignored if session handling is not turned on.
Web sessions are optional for Web services and do not apply to REST services.
minimum_response_time element
The minimum_response_time XML element specifies the maximum time in seconds before a response must be
sent back to the requestor. The default of zero (0) indicates that there is no minimum response time.
disable_messages element
The disable_messages XML element specifies that messages will not be displayed in message boxes on the
client workstation running the application. An example of a message box being displayed is a user, accessing a
JadeForms application through a browser, making a repeat request. A message box warns that the repeated
message will be ignored.
This element applies only to Web-enabled applications run as GUI applications. The default value for this element
is false.
output_maximum_length element
The output_maximum_length XML element specifies the maximum number of characters to be displayed in the
Web-enabled application monitor window. If you do not specify a maximum length for output or specify a value of
zero (0), there is no restriction on the amount of text that is output.
log_file_name element
The log_file_name XML element specifies the file to which all logging that is displayed on the Web-enabled
application monitor window is written. If the file name is invalid or the file could not be created, a file with the
default name of websessions.log is used. If you do not specify a log file name, no logging to disk takes place.
logmessagecontent element
The logmessagecontent XML element specifies whether Web message content is logged in the JADE Web
Application Monitor window. By default, any Web logging includes the Query String = content and Http String =
content output. The default value for this element is true.
Set this element to false if you do not want to include the Query String = content and Http String = content
message content.
This element applies only if the disable_logging element in the Web application configuration file or the
DisableLogging parameter in the [WebOptions] section of the JADE initialization file is set to true, or tracing is
turned on when the Enable Logging command is displayed in the View menu of the JADE Web Application
Monitor window. (The value of this command toggles between Enable Logging and Disable Logging.)
When you initiate the Web Application monitor and tracing is on, a message is displayed indicating the status of
the LogMessageContent element, as follows.
WebApps - 2018.0.01
Web Application Guide
disable_logging element
The disable_logging XML element specifies whether the JADE Monitor application logs and displays information
relating to requests and whether responses for Web-enabled applications run as GUI applications. Setting a value
for this element has no impact on Web-enabled non-GUI applications. Disabling logging has a significant positive
impact on throughput.
Tip Use Web-enabled non-GUI applications for production systems and Web-enabled GUI applications for
debugging purposes.
lock_retries element
The lock_retries XML element specifies the number of times to retry a lock exception before aborting a request.
The default value for this element is 20.
prompt_on_shutdown element
The prompt_on_shutdown XML element specifies whether a message is displayed when the application is shut
down and there are active Web sessions. Setting a value for this element has no impact on Web-enabled non-GUI
applications.
If the value of the prompt_on_shutdown element is true (which is the default value), a message is displayed and
the application does not shutdown until a response is made to the message.
firewall element
The firewall XML element specifies whether the jadehttp support library is outside a firewall.
If the value of the firewall element is true, any images that are generated must be transferred to jadehttp so that it
can create the files in a directory outside the firewall (as the Web-enabled application is inside the firewall, it
cannot see the directory).
monitor_font element
The monitor_font XML element specifies the font used in the Web Application Monitor window. The font is
specified as a comma-delimited string specifying the font name, font size, font bold, and font color respectively.
The following example displays monitor output in red using the 15 point bold Tahoma font.
<monitor_font>Tahoma,15,true,255</monitor_font>
base_uri element
The base_uri XML element is the root element for specifying the various parts of the Uniform Resource Identifier
(URI).
protocol element
The protocol XML element specifies the default protocol to be used. The value of this element can be http (which
is the default value) or https.
WebApps - 2018.0.01
Web Application Guide
The values of the protocol, machine_name, and virtual_directory elements are used for generating hyperlinks
and the form action value.
machine_name element
The machine_name XML element specifies the machine name or TCP/IP address of the target host. The default
value for this element is null.
The values of the protocol, machine_name, and virtual_directory XML elements are used for generating
hyperlinks and the form action value.
virtual_directory element
The virtual_directory XML element is the directory as specified to the Web server and it is the directory where the
jadehttp module is located. The default value for this element is null.
The values of the protocol, machine_name, and virtual_directory XML elements are used for generating
hyperlinks and the form action value.
support_library element
The support_library XML element is the library or module used for communicating between the Web server and
the JADE Web-enabled application.
jade_forms element
The jade_forms XML element is the root element for specifying configuration parameters that apply only to
JadeForms applications.
physical_directory element
The physical_directory XML element specifies the physical directory that corresponds to the virtual directory
specified by the value of the virtual_directory element. Image and script files that are generated by the framework
are placed in this directory. The default value for this element is null.
maximum_HTML_size element
The maximum_HTML_size XML element specifies the maximum length of the HTML string that is to be
generated. The default value for this element is zero (0), which means there is no limit.
scrolling_text element
The scrolling_text XML element specifies the scrolling text that is to appear in the status window of the browser.
The default value for this element is null.
show_modal element
The show_modal XML element specifies whether an instruction in the code to display a form by using the
showModal method actually displays the form by using the show method, or whether an error is generated.
The default value for this element is false, which results in an error being generated.
WebApps - 2018.0.01
Web Application Guide
cross_browser element
The cross_browser XML element specifies whether cross-browser compatibility is required. If you set the value of
this element to true, the generated code for all browsers is HTML version 3.2. The default value for this element is
false.
form_style element
The form_style XML element specifies whether Web pages are displayed as windows (that is, with captions and
borders) when using Internet Explorer browsers or simply as Web browser pages.
use_html4 element
The use_html4 XML element specifies whether HTML 4.0 generation is required for all browsers. The default
value for this element is false.
web_events element
The web_events XML element is the root element that enables you to specify (for Internet Explorer 4.0 and above
only) whether events other than clicking a submit button or a hyperlink can be captured.
control_name element
The control_name XML element specifies controls that can participate in a click event other than the standard
default values. Separate control names with commas.
image_type element
The image_type XML element is the format of the image files that are displayed on the generated Web pages.
The default generated image type is jpg (Joint Photographic Experts Group). You can also specify a png (Portable
Network Graphics) or gif (Graphics Interchange Format) file type.
page_sequencing element
The page_sequencing XML element specifies that forms that are generated have a hidden field with a sequence
number, which is incremented with each request. If the value of this element is set to true, an exception is raised if
requests arrive in an incorrect sequence. The exception must be handled by user code. The default value for this
element is false.
html_documents element
The html_documents XML element is the root element that enables you to specify configuration parameters that
apply only applications of HTMLDocuments type.
home_page element
The home_page XML element specifies the first page to be displayed when a request is made to the application.
The value of this element overrides the value set for the application. The default value for this element is null.
WebApps - 2018.0.01
Web Application Guide
html_page_sequencing element
The html_page_sequencing XML element specifies that generated forms have a hidden field with a sequence
number, which is incremented with each request. If the value of this element is set to true, an exception is raised if
requests arrive in an incorrect sequence. The exception must be handled by user code. The default value for this
element is false.
web_services_provider element
The web_services_provider XML element is the root element for specifying configuration parameters that apply
only to Web services provider applications.
read_timeout element
The read_timeout XML element is the length of time in seconds to wait before terminating a read request. The
default value for this element is 120.
use_session_handling element
The use_session_handling XML element to specify that a SOAP header is to be generated automatically with a
session id for every request in a Web services application.
<?xml version="1.0"?>
<jade_config>
<web_services_consumer schema="" name="" id="">
<web_config>
<consumer>
<endpoint></endpoint>
<maximum_connections></maximum_connections>
<connection_timeout></connection_timeout>
<send_timeout></send_timeout>
<receive_timeout></receive_timeout>
</consumer>
</web_config>
</web_services_consumer>
</jade_config>
The empty XML elements represent parameters that can be configured; for example, you can configure the
<connection_name/> element with the value WebApp, by replacing the empty element with a non-empty
element, as follows.
<connection_name>WebApp</connection_name>
In addition, the application XML element has three empty attributes that you can configure, as follows.
WebApps - 2018.0.01
Web Application Guide
jade_config element
The jade_config XML element is the root element for the document.
web_services_consumer element
The web_services_consumer XML element contains the following attributes.
name specifies the name of the Web services consumer to which the settings apply
id specifies an identifier string that enables copies of the same Web services consumer application to run
with different configuration parameters
You can repeat the web_services_consumer element to specify configuration information for a number of Web
services consumers. The special name global is used for configuration information that applies to all Web services
consumers. Only settings that need to be changed are defined in a specific consumer section.
In the following example, there is configuration information that applies globally to all Web services consumers,
specific configuration information for WebConsumer1, and specific configuration information for WebConsumer2.
<?xml version="1.0"?>
<jade_config>
<web_services_consumer schema="WebSchema" name="global" id="">
// configuration info applying to all consumer applications
</web_services_consumer>
<web_services_consumer schema="WebSchema" name="WebConsumer1" id="">
// configuration info specific to WebConsumer1
</web_services_consumer>
<web_services_consumer schema="WebSchema" name="WebConsumer2" id="">
// configuration info specific to WebConsumer2
</web_services_consumer>
</jade_config>
The id attribute is used to enable the same Web services consumer to be run with different configuration settings.
In the following example, the application WebConsumer can be run with the id="200" configuration settings or
the id="300" configuration settings.
<?xml version="1.0"?>
<jade_config>
<web_services_consumer schema="WebSchema" name="WebConsumer" id="200">
// configuration info specific to WebConsumer run with id "200"
</web_services_consumer>
<web_services_consumer schema="WebSchema" name="WebConsumer" id="300">
// configuration info specific to WebConsumer run with id "300"
</web_services_consumer>
</jade_config>
The following shortcut runs the WebConsumer application with the id="300" configuration settings.
WebApps - 2018.0.01
Web Application Guide
web_config element
The web_config XML element is the root element for the general Web-enabled application settings.
consumer element
The consumer XML element is the root element for the general Web consumer application settings.
endpoint element
The endpoint XML element specifies the endpoint Uniform Resource Locator (URL) to be used when calling this
consumer Web service.
maximum_connections element
The maximum_connections XML element specifies the maximum number of allowed simultaneous connections.
The default value for this element is two (2), which comes from the HTTP 1.1 standard.
For example, setting the value of the maximum_connections XML element to eight (8) enables a maximum of
eight (8) simultaneous connections on the Windows platform.
connection_timeout element
The connection_timeout XML element specifies the length of time in seconds to wait before terminating a
connection attempt. The default value for this element is 120.
send_timeout element
The send_timeout XML element specifies the length of time in seconds to wait before terminating a send attempt.
The default value for this element is 120.
receive_timeout element
The receive_timeout XML element specifies the length of time in seconds to wait before terminating a receive
attempt. The default value for this element is 120.
The following XML document represents a blank configuration file for a Web-enabled application.
<?xml version="1.0"?>
<jade_config>
<application schema="" name="" id="">
<web_config>
<connection_name/>
WebApps - 2018.0.01
Web Application Guide
<application_copies/>
<session_timeout/>
<minimum_response_time/>
<disable_messages/>
<log_file_name/>
<disable_logging/>
<lock_retries/>
<prompt_on_shutdown/>
<firewall/>
<base_uri>
<protocol/>
<machine_name/>
<virtual_directory/>
</base_uri>
<support_library/>
<jade_forms>
<physical_directory/>
<maximum_HTML_size/>
<scrolling_text/>
<show_modal/>
<cross_browser/>
<form_style/>
<use_html4/>
<web_events>
<control_name/>
</web_events>
<image_type/>
<page_sequencing/>
</jade_forms>
<html_documents>
<home_page/>
<html_page_sequencing/>
</html_documents>
<web_services_provider>
<read_timeout/>
</web_services_provider>
</web_config>
</application>
</jade_config>
The empty elements represent parameters that you can configure; for example, you can configure the
<connection_name/> element with the value WebApp, by replacing the empty element with a non-empty
element, as follows.
<connection_name>WebApp</connection_name>
In addition, the application element has three empty attributes that you can configure, as follows.
Tip You do not have to edit the XML directly, as JADE provides the Web Configuration application that enables
you to create and maintain the configuration files.
The shortcut to run the Web Configuration application has the schema parameter set to JadeMonitorSchema and
the application parameter set to JadeWebConfigurator.
You can pass an optional filename command line parameter to specify the name of the file to edit.
WebApps - 2018.0.01
Web Application Guide
The filename parameter must be separated from the standard parameters by the startAppParameters
parameter, as follows.
c:\jade\bin\jade.exe schema=JadeMonitorSchema
app=JadeWebConfigurator
path=c:\jade\system
ini=c:\jade\system\jade.ini
startAppParameters
filename=c:\temp\webservice.xml
Running the application (without startAppParameters and filename parameters) displays the following window.
Command Description
New Provides a submenu containing the Application and Consumer commands
Application Enables you to configure a Web-enabled or REST services application
Consumer Enables you to configure a Web services consumer
Open Displays the common File Open dialog
Append New Defines multiple Web applications or consumers in the one configuration file
Save Displays the common File Save dialog
Save As Displays the common Save As dialog
Exit Exits from the Web Configuration application
New Command
To configure a new Web application or Web service consumer
Select the New command from the Web Runtime Configurator File menu.
A submenu containing the Application and Consumer commands is then displayed. For details, see the following
subsections.
WebApps - 2018.0.01
Web Application Guide
Application Command
The list in the pane at the left of the Web Runtime Configurator window is then populated with items in blue
and items in black, as shown in the following image.
The black items (for example, schema, name, and id) represent configuration parameters. You can enter a
value for a configuration parameter in the corresponding cell in the pane at the right of the window.
The blue items (for example, jade_config, application, and web_config) represent groupings of
configuration parameters. When you click the plus sign (+) to the left of a blue item, the display expands to
show the configuration parameters of the item and possibly other grouping items.
For details about the elements in a Web application configuration file that you can configure, see "Elements
in the Application Configuration File", earlier in this chapter.
2. Expand the node in the pane at the left of each configuration file entity whose values you want to display in
the pane at the right of the window.
3. To edit the configuration file, click in the appropriate row in the pane at the right of the window and maintain
the value in that row to meet your requirements.
4. Repeat step 3 of this instruction for each value that you want to maintain.
WebApps - 2018.0.01
Web Application Guide
Consumer Command
The list in the pane at the left of the Web Runtime Configurator window is then populated with items in blue
and items in black, as shown in the following image.
The black items (for example, schema, name, and id) represent configuration parameters. You can enter a
value for a configuration parameter in the corresponding cell in the pane at the right of the window.
The blue items (for example, jade_config, application, and web_config) represent groupings of
configuration parameters. When you click the plus sign (+) to the left of a blue item, the display expands to
show the configuration parameters of the item and possibly other grouping items.
For details about the elements in a Web services consumer configuration file that you can configure, see
"Elements in the Web Services Consumer Configuration File", earlier in this chapter.
WebApps - 2018.0.01
Web Application Guide
Open Command
To edit an existing Web application configuration file or Web services consumer configuration file
1. Select the Open command from the Web Runtime Configurator File menu.
2. In the common File Open dialog that is then displayed, select the configuration file that you want to edit. The
pane at the right of the Web Runtime Configurator window is then populated with the appropriate
information, as shown in the example in the following image in which a file called
e:\temp\webappconfig.xml was selected.
3. Expand the node in the pane at the left of each configuration file entity whose values you want to display in
the pane at the right of the window.
4. To edit the configuration file, click in the appropriate row in the pane at the right of the window and maintain
the value in that row to meet your requirements.
5. Repeat step 4 of this instruction for each value that you want to maintain.
WebApps - 2018.0.01
Web Application Guide
1. Select the Append New command from the Web Runtime Configurator File menu. For example, to add two
more applications to a file called e:\temp\webappconfig.xml, select the Append New command twice, in
which case the example shown in the following image is then displayed.
2. Expand the node in the pane at the left of each Web application configuration file entity (or Web services
consumer configuration file) whose values you want to display in the pane at the right of the window.
3. To edit the configuration files, click in the appropriate row in the pane at the right of the window and maintain
the value in that row to meet your requirements.
4. Repeat step 3 of this instruction for each value that you want to maintain.
5. Use the File menu Save As command to save the file to an .xml file name and location of your choice.
Save Command
To save your Web application or Web service consumer configuration file
The common File Save dialog is then displayed, enabling you to save your .xml file.
Save As Command
To save your configuration file to a specified name and location
WebApps - 2018.0.01
Web Application Guide
The common Save As dialog is then displayed, enabling you to save your .xml file to a name and location of your
choice.
If you are editing an existing file, the file name defaults to the name of this file. If it is not an existing file, specify the
file name that you require.
Exit Command
Select the Exit command from the Web Runtime Configurator File menu to shut down the Web Configuration
application and close the Web Runtime Configurator window.
The sections of the jadehttp.ini file and the Web application configuration file included with each configuration are
incomplete. They include only the elements required to illustrate each configuration; you may require additional
elements to build a running environment.
Configuration 1: Minimum
This image shows the simplest configuration. The Web service is offered to consumers at a single URL
(http://www.Company.com/Jade/jadehttp.dll?MyWebService...) supplied by IISWebServer-1. A single copy of the
Web application running in JadeNode-N1 on JadeServer-S1 handles all requests, one at a time.
The TCP port number used by jadehttp.dll to connect to the Multi Worker TCP Transport (MWTT) group of the
application is 21001 (TcpConnection and TcpPort parameter values). A maximum of 10 outstanding requests is
permitted (MaxInUse parameter value).
WebApps - 2018.0.01
Web Application Guide
The jadehttp.dll queues a request to the Web application by opening a new connection or by reusing an idle
connection. When the jadehttp.dll has received the reply from a connection, it adds the connection to the idle list.
In this case, up to ten connections can be open between the jadehttp.dll and the MWTT for the Web application.
When ten requests are outstanding (and therefore ten connections are in use), additional requests are rejected
with an application is busy error.
If you specify a host name for the TcpIpConnection parameter, all DNS-provided address will be attempted. Both
the TcpIPv6 and TcpIPv4 protocols will be attempted on the provided IP addresses. Each connection failure will
be logged, and the next available combination tried.
WebApps - 2018.0.01
Web Application Guide
This image shows a configuration that splits the request processing workload between two copies of the Web
application running in a single JADE node. A maximum of 20 outstanding requests is permitted (MaxInUse).
When an application copy completes a request on a connection, it selects the next queued connection from the
MWTT connection queue and reads and processes the request. Each application copy is a JADE process and
requires a process license.
You can run more application copies in parallel, which will reduce the average overall elapsed time for each
request but increase contention for resources.
WebApps - 2018.0.01
Web Application Guide
This image shows a configuration that splits the request processing workload between two independent copies of
a Web application. Each copy has a separate independent connection queue. The jadehttp.dll distributes
requests by selecting a new or idle connection from the next group that has not yet reached MaxInUse
connections (round-robin selection).
Two application sections (each with a unique id) are defined, because the MWTT associated with each Web
application listens on a different TCP address and port.
It is unusual to use this configuration to expose a single Web application as it is possible that the request
processing load is not equally shared between the Web application copies. Configuration 2 in the previous
section is much more effective at sharing the processing load between multiple copies of a Web application.
The configuration in this section is more likely when several unrelated Web applications are exposed from the
same database environment. In that case, the jadehttp.ini file will contain a separate section for each of the Web
applications rather than the dual group section shown in the example in the following subsection.
WebApps - 2018.0.01
Web Application Guide
<connection_name>JadeServer-S1:21001</connection_name>
<application_copies>1</application_copies>
<base_uri>
<protocol>http</protocol>
<machine_name>www.Company.com</machine_name>
<virtual_directory>Jade</virtual_directory>
</base_uri>
<web_services_provider/>
</web_config>
</application>
<application schema="MySchema" name="MyWebService" id="Group-M2">
<web_config>
<connection_name>JadeServer-S1:21002</connection_name>
<application_copies>1</application_copies>
<base_uri>
<protocol>http</protocol>
<machine_name>www.Company.com</machine_name>
<virtual_directory>Jade</virtual_directory>
</base_uri>
<web_services_provider/>
</web_config>
</application>
</jade_config>
This image shows a configuration that splits the request processing workload between two independent copies of
a Web application, each running in separate JADE node within the same machine. This configuration avoids the
contention issues that arise when multiple JADE processes execute within a node but it requires more resource
such as memory.
WebApps - 2018.0.01
Web Application Guide
WebApps - 2018.0.01
Web Application Guide
This image shows a configuration that splits the request processing workload between multiple copies of a Web
application running in separate JADE nodes within the same machine. This configuration has less resource
contention than a configuration that has all Web application copies running in the same node.
You can use this configuration when a large number or requests must be processed in parallel but the local
resource usage (for example, CPU) per request is low, in which case the number of copies for each node will be
much higher (for example, 30 to 40). In addition, the outstanding request limit will be high (in this example, 500 for
each node).
WebApps - 2018.0.01
Web Application Guide
<base_uri>
<protocol>http</protocol>
<machine_name>www.Company.com</machine_name>
<virtual_directory>Jade</virtual_directory>
</base_uri>
<web_services_provider/>
</web_config>
</application>
<application schema="MySchema" name="MyWebService" id="Group-M2">
<web_config>
<connection_name>JadeServer-S1:21002</connection_name>
<application_copies>2</application_copies>
<base_uri>
<protocol>http</protocol>
<machine_name>www.Company.com</machine_name>
<virtual_directory>Jade</virtual_directory>
</base_uri>
<web_services_provider/>"
</web_config>
</application>
</jade_config>
WebApps - 2018.0.01
Web Application Guide
This image shows a configuration that splits the request processing workload between two servers (that is, S1 and
S2). A single JADE node is running in each server. Although only two copies of the Web application are shown for
each node, it is more usual to run two or three copies for each logical CPU, depending on the resource usage for
each request. Each node (and therefore each server) can have up to 200 outstanding requests.
You could extend this configuration by running multiple nodes in one or more of the servers.
WebApps - 2018.0.01
Web Application Guide
This image shows a configuration that exposes the Web service via two Web servers. In this example, one is IIS
and the other is Apache. A reason for using this configuration is to allow one Web server to expose the service
within your company and the other to expose the service to the Internet.
WebApps - 2018.0.01
Web Application Guide
WebApps - 2018.0.01
Chapter 4 Using the Rich Internet Application
(RIA) Framework
Overview
Generating JavaScript
Client-Side Caching
WSUtil.js
Classes.js
Web-service_api.js
Web-service_types.js
Web-service_testharness.html
Overview
The classic JADE Web application framework centered all activity on a client-server round-trip architecture with a
Web service architecture. Under this system all processing is done on the server, and the client is only used to
display static HTML content. The biggest drawback with this approach is that all interaction with the application
must pass through the server; that is, data is sent to the server, the server responds, and a full page refresh occurs
on the client with the response, when only a small part of the display requires updating.
By using a client-side technology that can execute instructions on the client’s computer, Rich Internet Applications
(RIAs) can circumvent this slow and synchronous loop for many user interactions and perform partial page
updates.
The main characteristic of an RIA is that it has an intermediate layer of code, often called a client engine, between
the user and the server. This client engine is usually downloaded at the beginning of the application, and can be
supplemented by further code downloads as the application progresses. The client engine acts as an extension of
the Web browser, and usually takes over responsibility for rendering the user interface and for server
communication.
In a RIA, it is not uncommon for a large number of messages to be sent between a browser client and the server,
but the size of each message is typically small. An example of the way this strategy works would be a user
completing address and phone number details on a form in a Web browser. When the user tabs out of the phone
number field, a message can be generated to validate the number that was entered. The message is sent to the
appropriate JADE Web service method and the response is sent back to the browser. The browser client
processes the response and takes any action that is necessary.
WebApps - 2018.0.01
Web Application Guide
The JADE Rich Internet Application framework uses the JavaScript language. It is a client-side language that can
run code and is installed on most Web browsers. JavaScript code is used to facilitate the messaging and event
handling and the JADE Web service framework is the client-server communication link in this Rich Internet
Application strategy.
The browser client, by executing JavaScript, manipulates the displayed page with incremental updates avoiding
the traditional full page refreshes.
Note Although the generated JavaScript should work in most current browser versions, we recommend one of
IE 6.0, IE 7.0, Firefox 2.0, Firefox 3.0, Chrome 1.0, or Safari 3.2.
The generator supports only Web services in the document/literal SOAP 1.1 format.
The generated files are downloaded and used on the client. The JavaScript developer can simply interact with the
messages as though they were static methods. For example, a Web service provider application named
CustomerService provides a JADE Web service method with the following signature.
In this example, Jade is the namespace specified by the user who generated the JavaScript.
Client-side cache
Session handling
Exception handling
Message preprocessing
Generating JavaScript
You can generate JavaScript for a Web service provided by or consumed by JADE.
1. In the Web Service Consumer Browser, select the consumer subclass with which you want to interact.
WebApps - 2018.0.01
Web Application Guide
The Web Service JavaScript Generation dialog, shown in the following example, is then displayed.
3. If you want the JavaScript files created in a directory other than the program directory, enter the location in
the Output Directory text box. Alternatively, click the Browse button and the common file Open dialog is
then displayed to enable you to select the appropriate location.
4. Enter a namespace in the Module Namespace text box. The namespace refers to the root JavaScript
variable name that the generated scripts use. For example, if the namespace is Jade, the instruction to call a
Web service from JavaScript would be in the following format.
Jade.<provider>.<method>(<parameters>);
5. Click the Generate button. Alternatively, click the Cancel button to abandon your selections.
1. In the Exposure Browser, select the Web service exposure for which you want to generate JavaScript.
The Web Service JavaScript Generation dialog, shown in the following example, is then displayed.
3. If you want the JavaScript files created in a directory other than the program directory, enter the location in
the Output Directory text box. Alternatively, click the Browse button and the common file Open dialog is
then displayed to enable you to select the appropriate location.
4. Enter a namespace in the Module Namespace text box. The namespace refers to the root JavaScript
variable name that the generated scripts use. For example, if the namespace is Jade, the instruction to call a
Web service from JavaScript would be in the following format.
Jade.<provider>.<method>(<parameters>);
WebApps - 2018.0.01
Web Application Guide
5. Select a Web service provider application that uses the exposure in the Web service application combo
box. This enables the generated JavaScripts to access the correct application.
6. Click the Generate button. Alternatively, click the Cancel button to abandon your selections.
The following example shows the definition and registration of a callback function.
The framework enables you to pass a config object as an additional parameter to each Web service call. You can
set properties on the config object to specify how the framework deals with the call.
In the previous example, the callback property is set to refer to a function that will be invoked when the Web
service replies. The function is passed the XML returned by the Web service. You could then extract the parts of
the reply in which you are interested (for example, by using a helper library such as jQuery) and carry out
processing based on the response.
Client-Side Caching
For Web service calls that repeatedly request the same, static information (for example, post codes), the RIA
framework has a built-in cache to store the information. Response times for the client application can be reduced
by eliminating unnecessary traffic across the Web. You can set the following options in the config object for the
cache.
cache: true
This setting causes the result of the Web service to be stored in the cache. Further calls to the same service
that also have cache: true perform a simple cache lookup rather than invoke the Web service.
cacheExpiry: number-of-seconds
This setting specifies the number of seconds the entry remains in cache before it expires. When an entry
expires, the next call to the Web service method invokes the Web service rather than using the cached value.
cacheKey: String
The primary key is the method name, so that multiple calls to the same method use the same cached value.
For a method with parameters, you would almost certainly not want to use the same cached value for all calls
to that method. If a cacheKey value is specified, only an entry in the cache that matches the method and the
cacheKey is considered to match the request.
Note Individual method calls with unusual parameters can bypass the cache, by not using the cache: true
option.
WebApps - 2018.0.01
Web Application Guide
This places severe restrictions on the use of JavaScript to invoke Web services. The service provider must reside
on the same domain as the JavaScript; that is, the JADE service provider and the server on which the JavaScript
is located must share the same domain name.
In a simple case, where the directory containing the jadehttp.dll file is the JADE binary directory c:\jade\bin and
has the alias jade in Microsoft Internet Information Server (IIS), the JavaScript must reside in a subdirectory of the
JADE binary directory.
The browser can access the JavaScript files using the following IIS address, as follows.
http://webserver/jade/Provider_testharness.html
Web browser security prevents direct access through the file URL, as follows.
file:///c:/Jade/bin/Provider_testharness.html
The accepted way to invoke cross-domain Web services from JavaScript is through your Web server; that is,
arrange for the JADE Web service provider on your Web server to consume the external service (for example, the
Google search service) and then create a provider in JADE to provide that service to your JavaScript.
The JavaScript performs a Web service call to the JADE service provided by your Web server, which acts as an
intermediary and requests the data from Google.
Note Do not leave a trailing comma after the last key:value pair in your JSON, as some Web browsers may not
behave correctly.
An object is created with properties name and age, which are initialized to "Harry" and 17, respectively. It is
equivalent to the following JavaScript code.
JSON notation helps in making JavaScript code simpler and easier to read.
WebApps - 2018.0.01
Web Application Guide
File Provides
Classes.js Generic type-safe class framework
WSUtil.js Generic essentials required to invoke Web services
Web-service_types.js Types exposed by the Web service
Web-service_api.js JavaScript methods to invoke the Web service methods
Web-service_testharness.html Sample Web application used to check the framework is
functioning correctly
Note There are dependencies among these files. When including them within an HTML file, include the .js files
in the order listed in the above table.
The WSUtil.js and Classes.js files are independent of the specific Web service. If the JavaScript needs to invoke
two or more separate Web services, it therefore requires only one copy of these files.
WebApps - 2018.0.01
Web Application Guide
For each Web service, the corresponding Web-service_api.js and Web-service_types.js files are required.
For details about the generated JavaScript, see the following subsections.
WSUtil.js
The WSUtil.js file provides the following public methods and properties:
Classes.js
The Classes.js file provides the public Class.New() method, which has the following signature.
The Class.New() method creates a new JavaScript class. After the class has been created, it has a number of
methods and properties that can be invoked.
As a general rule, call the setProperties() method after calling the Class.New() method, to make the class a class
with properties, or the isArrayOf() method, to make an array class. After invoking one of these methods, you can
create instances of the class by using the new keyword.
WebApps - 2018.0.01
Web Application Guide
Classes with properties have set and get methods for each property. In the following example, a class is created
with a color property. If the corresponding color() method is called with a parameter, the method sets the value of
the color property. If it is called without a parameter, the method gets the value of the color property. The method
checks the types of values used.
The following example shows the use of the Class.New() method to create a class with properties.
If the isArrayOf() method is called instead of the setProperties() method, the class is an array class. After
invoking this method, you can create instances of the array by using the new keyword.
The following example shows the use of the Class.New() method to create an array.
The Class.New() method creates a Class object with the following properties and methods.
WebApps - 2018.0.01
Web Application Guide
Instances of the Class Class (that is, the actual objects created when you use the new keyword to create an
instance of the class) have the following properties.
Property Description
ClassName(): String Returns the name of the class.
IsArray(): Boolean Returns whether the class is an array class (by default, classes are not
array classes, unless isArrayOf(memberType) has been called).
SuperClass(): Class Returns a reference to the superclass.
Function Description
MemberType(): Class Returns the member type of the array.
<constructor>(valueArray: Array of MemberType) Optionally invokes the Array(valueArray) function in
the TypedArrayClass interface, if a parameter is
provided.
Function Description
MemberType(): Class Returns the member type of the array.
Array(valueArray: Array of MemberType) Replaces the array with the values passed, after type-
checking.
Array(): Array Returns a copy of the private internal type-checked
array object.
Add(value: MemberType) Adds a value to the array. If the value is not of
MemberType, an exception is raised.
Function Description
Properties(): Object Returns the properties passed to the setProperties() function when
the class was defined.
WebApps - 2018.0.01
Web Application Guide
Function Description
<constructor>(values: Object) Invokes the SetProperties(values) function on the instance, if the
parameter is provided.
Function Description
Properties(): Object Returns the properties passed to setProperties() when the class was
defined.
SetProperties(values: Object) Sets the values of any number of properties after type-checking. For
example, {name: "Andrew", age: 21, children: myChildrenArray}.
Instances of the TypedPropertyClass interface also have get and set methods with the names specified in the
setProperties() method, as shown in the following example if the Person class has name and age properties.
Person.setProperties({name:String, age:Number});
You can set and get the value of the name property of an instance of the Person class, as follows.
Web-service_api.js
The Web-service_api.js file provides one method for each method defined by the Web service. Each method has
parameters identical to those provided by the Web service, with an additional config parameter that is optional.
The OnSessionTimeout() method provided in the Web-service_api.js file enables you to specify a function to be
invoked when a Web session times out. Typically, you could code a JavaScript function that asks the user to log
on again. When the function is called with a null parameter, the callback is unset.
Note Setting an OnSessionTimeout callback when using a Web service that does not support session handling
results in all return messages being sent to that callback function.
You can set the following properties for the config object.
Property Description
callback: Function This function is invoked when the Web service responds.
preprocessor: Function, or false This function is invoked before the callback function. The specified
function is invoked instead of any general preprocessor set in the
WSUtil.js file. Setting this value to false means that no preprocessor
function is invoked. The preprocessor function itself can return true, to
prevent the callback being invoked.
exceptionHandler: Function, or false This function is invoked instead of preprocessor and callback functions
if the service provider returns an exception. Setting this value to false
means that the exception is ignored and no handler function is called. If
this value is not specified, the handler specified in the WSUtil.js file is
used.
cache: Boolean If true, checks whether the value is in the local cache before invoking
the Web service. If it is not in cache, it stores the value in the cache
when the service responds.
WebApps - 2018.0.01
Web Application Guide
Property Description
cacheExpiry: Number, or false Only relevant if cache: true is set. Indicates the number of seconds the
entry remains in the cache before expiring. A value of false indicates
that the entry never expires. If a value is not specified, the default cache
expiry setting defined in the WSUtil.js file is used. The expiry time for
an item in cache is governed by the lowest value of cacheExpiry
specified by the config objects of any of the calls that use it.
cacheKey: String Provides a secondary dictionary key for entries in the cache. An entry
in the cache is considered a match only if the method being invoked is
the same and the value of cacheKey is the same.
Note There is no requirement in JavaScript for the parameters of a function to match the number of parameters
with which it is invoked, although a parameter cannot be used if it is not included in the signature.
InvocationArguments
CacheObject
The InvocationArguments parameter is the parameters with which the Web service call was invoked, and is an
array containing the following entries.
An instance of one of the classes from the Web-service_types.js file of the Web service containing the
parameters passed to the Web service method
The config object, which enables the handler to determine which method call it is handling
An easier way to pass information from the caller to the handler is to declare the handler function within the scope
of the caller, as shown in the following example.
This example uses an anonymous function, which is generally the easiest way to write Web service calls. In
JavaScript, a function definition can be supplied where a function reference is expected. Instead of defining a
function called handleResponse and specifying it by name as the callback function, you can simply define the
function in-line without a name. Such anonymous functions can access all of the data that is accessible within the
parent function.
WebApps - 2018.0.01
Web Application Guide
If the call uses the cache, a third parameter is passed to the handler (its value is undefined if the cache is not
used). The third parameter is cacheObject, which is the entry in the cache representing the data. You can store
data that can be accessed during subsequent cache calls on this object. For example, when XML is received by
the preprocessor function of a user, data can be extracted and changed into a more-useful format. The
preprocessor adds a property to the cacheObject object, to store the data. All subsequent calls to the Web service
method see the data on cacheObject and do not need to repeatedly transform the XML.
Note All data stored on the cacheObject object is lost if the cache entry expires or if the cache is flushed.
Web-service_types.js
The Web-service_types.js file uses the class structure provided by the Classes.js file to construct all the classes
used by the Web service. This includes both Array classes and normal classes. These classes are exposed to the
user and are needed to invoke Web service calls where the parameters of the method are not primitive types; for
example, a CustWeb provider in JADE has the following Web service method.
addCustomers(CustomerArray) webService;
The CustomerArray class is an array of Customer objects. The Customer class has name and age properties
defined. The Web service is invoked from JavaScript, using the generated framework as follows.
Web-service_testharness.html
The test harness application is an HTML and JavaScript application that behaves similarly to the standard JADE
Web service test harness. For details about the standard test harness, see "Testing the Web Services Interface", in
Chapter 11 of the JADE Developer’s Reference.
You can use the JavaScript Web service test harness to test that the generated framework is working. You cannot
simply double-click the generated file to load it into the browser, as the browser prevents the Web service calls
because of cross-domain security restrictions. Instead, you can copy the generated files to a Web server and
access them through it. For details, see "Restricted Cross-Domain Calls", earlier in this chapter.
WebApps - 2018.0.01