Omnis Technical Note TNWE0022 August 2008

Testing Web Client Applications with Windows IIS

For Omnis Studio
By Gary Ashford

So, you followed the tutorial and built your first Web Client application and you're ready to test/deploy to your intranet. You reach the end of the manual where it says; Contact your IS department or Webmaster who will be able to help you. All very well unless that person happens to be you!

This Tech Note shows you how to set-up a Web Server on a Windows 2000/XP/Vista series Server*. It assumes that you have a working Web Client application that you have tested as far as possible using the Test Form facility available in design mode and you are now ready to test the multi-threaded aspects of your application or to make it available to a wider audience.

*Applies to Windows 200X Server, XP Professional and Microsoft IIS version 5. Setup will be slightly different for Windows Vista Home Premium, Vista Professional and Vista Server which supports IIS version 6/7. See Technote TNWE0023

Setting-up a Windows Web Server involves the following tasks:

1. Install Microsoft Internet Information Services (IIS)
To do this, go to your Start->Control Panel->Add or Remove Programs then select Add or Remove Windows Components
In the checklist which appears, select Internet Information Services if not already selected and press Next.
You may need to insert the Windows installation disk if prompted.
This is slightly different for Vista users, for example- Add/Remove Programs is termed 'Turning Windows Features On and Off.'

2. Create a directory for the Web Client Plug-in
Once IIS has been installed, a root folder is created where your Internet pages will reside. For Windows, this folder is named Inetpub and exists in the root of your installation drive (e.g. C:\Inetpub). Following the convention set out in the Programming Manual, you should navigate to this folder and create a sub-folder named cgi-bin (i.e. C:\Inetpub\cgi-bin).

Dependant on whether your application will be using the omnisapi.dll or nph-omniscgi.exe plug-in, you should copy one or other (or both) of these files from the Omnis\clientserver\server\cgi or isapi folders into the cgi-bin folder. You do not have to use the name 'cgi-bin', but the path to the plug-in must match that used by the script inside your web form. (See step 4, below).

3. Make the Plug-in Folder a 'Virtual Directory'
This step makes it possible for remote clients to execute code on the server.
Go to Start->Control Panel->Administrative Tools->Internet Information Services and expand the entry which is marked COMPUTERNAME (local computer). Expand the node marked Web Sites. Right-click on Default Web Site and select New->Virtual Directory...  This starts the Virtual Directory Creation Wizard.
When prompted, enter cgi-bin as the Alias Name and navigate to the Inetpub\cgi-bin folder.

On the pane which follows, ensure that the checkbox marked Execute (such as ISAPI applications or CGI ) is checked. Click Finish, then Right-Click on the newly created entry and select Properties.
Check the Script Source Access box and ensure that Execute Permissions is set to Scripts and Executables, as shown:

4. Copy in your Web Content and Change Script Settings
During development of your Web Client application, the template HTML file containing the Web Form is stored in the Omnis\html folder. You should now copy the .HTM file (or files) applicable to your application and place them inside the C:\Inetpub\wwwroot folder (along with any other web content that you may require). You should also copy in the omniswebclient.js javascript file since this is required by the plug-in.

You should then edit your HTM file(s) and locate the <javascript> tag containing the Omnis plug-in code.
In addition to the form width, form height, library and class name entries, you should verify that the server port entry (oserver) matches the value being used by Omnis Studio (i.e. the Omnis->Tools->Options $serverport property).
You should modify the owebserverurl to the IP address, DHCP lookup or Domain Name of the Web Server machine.
The owebserverscript entry should contain the Inetpub-relative path to the plug-in that is used by the web form.

<script type="text/javascript">
// Omnis replaces the text between $$Start and $$End, when it fills in the template
// $$Start

// $$End
// If you wish to use this page with a web server, set the following variables to the script and URL,e.g.
// owebserverurl=""
// owebserverscript="/cgi-bin/nph-omniscgi.exe"

// To enable auto-download of the Omnis Web Client Active X CAB file (providing support for Win32 Internet Explorer),
// set odownload to "yes"
// To pass parameters to the called Remote Task Instance set the following variables.
<script type="text/javascript" charset="utf-8" src="omniswebclient.js">
Omnis plug-in script- used by the web page containing the web form

5. Test Connection to the Web Application
Almost there! To ensure that the Omnis Server loads your Web Client library automatically, you may wish to move your library into the Omnis\startup folder. The application needs to be running and listening on the serverport in order to handle requests from Web Clients.
Either from the local or from a net - addressing the Omnis Server by its IP address, e.g. over a LAN
http://myserver/rForm1.htm - addressing the Omnis Server by its DHCP lookup (registered network name) - addressing the Omnis Server using a registered domain name

Provided the client machine has the Web Client (client-side) plug-in installed, the Omnis remote form should be displayed and you are ready to test your application. The Web Client plug-in is provided with the Omnis installation media and is also available for download from the Omnis website.