Getting Started-JetNet


Lesson 5 . Setting Up the Web Application Server

In Lessons 1 through 4 you set up the Panther application server, started the client, saved a service component and client screen to the correct libraries, updated the JIF, and tested the client screen. At the end of Lesson 4, a client made service requests to a server. In this lesson, you will set up a Panther web application and test the same client screen from a web browser.

A Panther web application server is installed on your HTTP server and can work with the following web architectures:

When a browser request comes in for a Panther screen, the HTTP server passes the screen name to Panther. Panther opens the screen, performs any processing on the screen including service calls, generates the HTML to display the screen, at which point the HTTP server transmits the HTML back to the browser that requested it. For more information on web applications, refer to the Web Developer's Guide.

This lesson shows how to set up a Panther web application and is independent of all subsequent lessons in this tutorial.

In this lesson you learn how to:

More About Web Application Server Processes

The Web Application Server consists of three executable processes for each application: requester, dispatcher, and jserver.

Before starting this lesson

Before beginning this lesson, you need to know the following:

This tutorial assumes that the Panther application server and the Panther web application server are installed on the same machine or accessible via the network. To test the screen on the web, your HTTP server must be able to access your application directory.


Start the Web Setup Manager

Each Panther web application must have an initialization file, which contains con figuration settings for the application. The Panther Web Setup Manager helps you create a new initialization file (or update an existing one).

  1. Start up your web browser (for example, Mozilla Firefox or Microsoft Internet Explorer).
  2. In the URL window, type the location of the Panther Web Setup Manager.

    UNIX HTTP server:

    http://hostMachineName/ProgramDirectory/websetup

    Windows HTTP server:

    http://hostMachineName/ProgramDirectory/websetup.exe

  3. Check that the Create an application radio button is selected.
  4. Choose Continue.

Enter the program locations

You assign each web application a unique name which is used to name the application's requester program and the application's initialization (.ini) file.

  1. For Application Name, enter a unique name to identify this lesson's web application, like tut_webapp.
  2. For SMBASE, type the full path pointing to the Panther web application server installation (which you recorded on page 5-2).
  3. For Program Directory, type the path to your HTTP server's program directory (which you recorded on page 5-2).

    Note: This should be a directory path, not a browser URL path.

  4. For application type, choose CGI.

    (There are three types of requester programs. Depending on your platform, your options can include CGI, NSAPI, and ISAPI.)

  5. Choose Continue.

    The program will now create both an .ini file and an executable specific to your application (for example, tut_webapp.ini and the executable tut_webapp). The next screen will tell you that both files have been created; the following steps will be to update the initialization file with the correct settings.

  6. Choose OK.

Check the settings for your Web Application Server

In the left-hand frame, you will see icons for the initialization settings specific to the Panther web application server. When you click on each setting, there will be an accompanying explanation of how to set that variable. Most settings can be left at the default for now; however, the following steps lead you through settings which you need to edit or double-check:

  1. In Application Directory, enter the path where you created your proltut directory in Lesson 1.

  2. Choose Server Executables in order to specify the location of the dispatcher and jserver executables. Generally, the path location is to the util directory of the web application server installation.

  3. In Dispatcher, set or check the full path name of the dispatcher executable.
  4. In Server, set or check the full path name of the jserver executable.
  5. Choose Server Variables.

  6. In Number of Servers, set it to 5. This is the number of concurrent users. Since this setting greatly affects performance, you must set it for each web application.
  7. Choose Licensing.

  8. In License File, set or check the path of your license.dat file.
  9. Choose Continue.

General environment settings

In the next section, you specify the environment settings needed by the web application server. You will see a new set of icons in the left-hand frame. Step through each category, editing or double-checking settings as necessary.

  1. In SMBASE, set or check the setting of the web application server installation.

  2. Choose Initial JPL.

  3. In SMINITJPL, enter initial.jpl.

    This is the name of the JPL file that will be run when the web application server starts. (Later in this lesson you will add this JPL file to the client library.)

  4. Choose Initial Development Libraries.

  5. In SMFLIBS, set or check the settings for client libraries:
    client.lib|com mon.lib.
  6. (UNIX only) Choose Shared Library Path.

  7. (UNIX only) Depending on the operating system, enter one of the following:

3-Tier Configuration

Depending on whether you are running the Panther web application server on a separate machine from your Panther application server, you will need to set this parameter in one of two ways, as outlined below.

  1. Choose 3 Tier Configuration from the left-hand menu.
  2. If you are running the Panther web application server on a different machine from the Panther application server, you will need to set a value for certain platforms. It is not needed if you are using JetNet or Oracle Tuxedo 6.4 or later. Choose one of the values below and enter it under Work Station Device:
  3. Choose Path.

  4. Check that the path location is set to the util directory of the web application server installation. If the jserver executable is not in the Panther webutil directory, you must set the correct path to the jserver directory here.
  5. Choose Continue.

Specify database settings and workstation jserver

The next screen allows you to enter Additional Environment Variables for such applications as databases. If you were setting variables for an Oracle database, for instance, type the variable under "Settings" (e.g., ORACLE_HOME) and the path name under "Value" (e.g., /usr/oracle). You will also be setting access to the JIF file.

  1. Under Setting, enter SMTPJIF, the Panther variable that identifies the JIF file.

    Note: If the EnableWebId option displays, note that it will not be used in the tutorial.

  2. Under Value, enter jif.bin.
  3. Choose Continue. A screen informs you that your Panther web application has been created.

  4. Choose Start Application.

Add JPL routines to the client library

When a Panther web application server starts up, it looks for a JPL web_startup procedure to handle any necessary startup processing, open and close connections to the middleware API (and therefore to the database), and create global variables. Similarly, when the server is shut down, it looks for the web_shutdown routine-accessed by all users of the web application-to perform processing such as clean up. Both procedures are in the JPL module initial.jpl which is in the tutorial library. By copying initial.jpl to your client library and setting SMINITJPL in proweb.ini, these routines automatically run when the web application server is initialized.

More About JPL

JPL is a powerful scripting language with a C-like syntax. You can write and edit JPL modules directly in the editor environment, using the JPL editor or your preferred test editor. You can also write JPL procedures directly to a library and call these procedures from objects in your screens.

You'll practice writing and executing JPL in Lesson 13 of this tutorial. For more information on JPL commands and syntax, refer to the online Programming Guide.

  1. For a UNIX client:
  2. For Windows client:
  3. Choose FileOpenJPL.

    The Open JPL Module dialog opens.

  4. Select tutorial.lib from the list of open libraries, and double-click on initial.jpl in the Members list to open it.

    The initial.jpl file opens in the JPL Program Text dialog box.

  5. Choose Save As. The Save JPL dialog opens with initial.jpl in the Member box.

  6. Select client.lib in the Libraries list. Choose OK.

    The initial.jpl file is saved to client.lib.

  7. Choose OK.
  8. Choose Close.
  9. Choose FileExit to end your editor session.

Change permissions of shared files (UNIX only)

The Panther web application server must be able to access some files in the application directory on UNIX. Because the user account for the HTTP server is different from your user account, the web application server is normally not allowed to write to your directory.

  1. Switch to the /proltut directory.

    If error.log does not exist, create an error log file and set its permissions so that the web application server has read and write access to the file:touch error.log

    chmod 666 error.log
  2. Change permissions so that the Panther web application server has read and write access to the server configuration file, broker.bin:
    chmod 666 broker.bin

Test the connection

Now you can start the Panther web application server and test the client/server connection by trying to invoke the service routine from your client screen with a web browser.

  1. If your Panther application server is not running, reactivate it now from the server machine (refer to Steps 27 to 31 on page 1-11 in Lesson 1 for UNIX or refer to Steps 22 to 26 on page 1-25 in Lesson 1 for Windows). Also, start the web browser, if it is not already running.
  2. Since the Panther web application server was started when you ran the web setup manager, you must restart it so that it will read the new JPL file:
    WebInstallDir/util/monitor -stop webAppname
    WebInstallDir/util/monitor -start webAppname

    Note: On Windows, if your web application has been installed as a service, then you use the following command to start the web application:

    WebInstallDir/util/net start webAppname
  3. Request the test screen with this URL:
    http://hostName/ProgramDirectory/webAppname/test

    The client screen appears.

  4. Click on the Test Service button.

    The phrase "It worked!" is displayed in the text box.

If you have a problem either starting the web application server or seeing the message returned from the server, refer to Appendix B on page B-1.

Stop and restart server after making any changes

If you make any changes to the web initialization (webAppname.ini) file, or if you see any error messages indicating that you failed to connect to the server, you must stop and restart your web application server to have the changes take effect. Shut down the server by going to a UNIX window and typing at a command prompt:

$SMBASE/util/monitor -stop webAppname

Edit the initialization file the same way you created it, by typing in the browser:

http://hostMachineName/ProgramDirectory/websetup

and choosing to update the application.

You can then restart the server by repeating the procedure outlined in Step 47 above.

Shut down the server

After you successfully start the web application server, you can shut it down. The lessons that immediately follow do not require its usage.

  1. Shut down the web application server:
    $SMBASE/util/monitor -stop webAppname

What did you do?

In this lesson, you performed these tasks:

What did you learn?

You learned: