Getting Started-2-Tier

Lesson 2 . Setting Up the Web Application Server

This lesson shows you how to set up a Panther web application server and test the server on 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, does any processing on the screen, generates the HTML to display the screen, and returns the HTML to your HTTP server, which transmits the HTML back to the browser that requested it. For more information, refer to the Web Developerment Guide.

More About Web Application Server Processes

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

In this lesson you learn how to:

Most of this lesson assumes that:

Before starting this lesson

Before you begin this lesson, determine the following:

Start the Web Setup Manager

Each Panther web application must have an initialization file, which contains con figuration settings for the application. The Web Setup Manager will walk you through the configuration settings and create or update the initialization file accordingly. The initialization file will have the same name as your application, for example tut_webapp.ini. The Web Setup Manager also copies over the executables and starts the application when it first creates the initialization file.

  1. In your web browser type the URL of the program directory on your HTTP server and run websetup.

    (UNIX server) http://hostname/ProgramDiectory/websetup

    (Windows server) http://hostname/ProgramDirectory/websetup.exe

  2. Check that the Create an Application radio button is selected.
  3. Choose Continue to set up your application directory and its settings.

Enter the program locations

You assign each web application a unique name which is used to name the application's CGI/ISAPI/NSAPI program and the application's initialization (.ini) file. The requester executable that is installed as part of the Panther web application server is named proweb. This requester executable is copied to have the same name as your web application.

  1. For Application Name, type the unique application name you are using to identify your web application, for example, tut_webapp.
  2. Set SMBASE to the full path name of your Panther web installation directory. (Refer to "Before starting this lesson.")
  3. Enter the full path to the program directory that contains the executables used by the HTTP server. The program directory may contain CGI (.exe), NSAPI (.nsa), or ISAPI (.isa) executables depending on the protocols used by your HTTP server. (Refer t "Before starting this lesson.")

    Note: The program directory is determined by your HTTP server. If you are not sure of this directory, or if you run into permission problems accessing it, check with your system administrator. It should be a directory path, not a browser URL.

  4. For application type, choose CGI by selecting the radio button.

  5. Choose Continue.

    The Web Setup Manager will confirm that both an .ini file and an executable specific to your application (for example, tut_webapp.ini and tut_webapp have been created.

  6. Choose OK.

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. Some browsers will display a default; most settings can be left at the default for now. Settings which you need to edit or double-check include:

  1. Set the Application Directory to the full path name of your proltut directory.

  2. Choose Server Executables.
  3. In Dispatcher, set or check the full path name of the dispatcher executable, generally, the path location to the util directory of the web application server installation.

    UNIX WebInstallDirectory/util/dispatcher

    Windows WebInstallDirectory\util\dispatcher.exe

  4. In Server, set or check the full path name of the jserver executable.

    UNIX WebInstallDirectory/util/jserver

    Windows WebInstallDirectory\util\jserver.exe

  5. Choose Server Variables to display the server options.
  6. Set Number of Servers 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 to display the licensing options.
  8. Set or check the path of your license.dat file.

  9. Choose Continue.

General environment settings

The next section allows you to create and update tut_webapp.ini settings relevant to the general environment. 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 full path name of the Web Application Server installation directory.

  2. Choose Initial JPL.
  3. Set SMINITJPL to initial.jpl.

  4. Choose Initial Development Libraries.
  5. In SMFLIBS, set or check client.lib.

  6. (UNIX only) Select Shared Library Path.
  7. (UNIX only) Depending on the operating system, enter one of the following:
  8. Choose Path.
  9. Set Path to the full path name of util in the WebInstallDir directory.

  10. Choose Continue.
  11. The Additional Environment Variables screen appears. Choose Continue.
  12. The Web Setup Manager will give you a message that your application has been created. Choose Start Application or exit from your browser.

    The Web Setup Manager has created your web application .ini file and copied the appropriate executables for that application.

  13. If you started the application, shut it down from the command line:

    UNIX WebInstallDir/util/monitor -stop WebAppname

    Windows WebInstallDir\util\monitor -stop WebAppname

Add JPL routines to the client library

When a web application server starts up, it looks in its JPL module—specified by the web initialization file variable SMINITJPL—for the web_startup procedure to handle startup processing. This processing can include opening database connections and creating global variables. The module distributed for this tutorial—in itial.jpl—contains a web_startup procedure that initializes the JDB database engine and establishes a connection to the vidsales database:

proc web_startup

When the server shuts down, it looks in the same module for the web_shutdown procedure to perform cleanup operations such as closing the database connection. The web_shutdown procedure for this tutorial closes the database connection established earlier by web_startup:

proc web_shutdown

The distributed tutorstd.lib library contains a web initialization file. A copy of this module must be saved in the client library.

  1. Start the Panther editor:
  2. In the editor, choose FileOpenLibrary and select tutorstd.lib.
  3. Choose FileOpenJPL.

    The Open JPL Module dialog opens.

  4. Select tutorstd.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.

  6. Select client.lib in the Libraries list, and initial.jpl appears in the Member box. Choose OK.

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

  7. On the JPL Window, choose Close.
  8. Choose FileExit to end your editor session.

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 9 of this tutorial. For more information on JPL commands and syntax, refer to the Programming Guide.

Change permissions

Make sure the application directory can support the web application server started by the httpd program. Because the user that the httpd program runs under is different from your user login, the web application server is normally not allowed to write to your directory.

Test the connection

Now you can start the web application server and test the client/server connection by opening your client screen in a web browser.

  1. If your HTTP server is not running, activate it now. Also start the client's web browser on your PC if it is not already running.
  2. Start the web application server from the command line:

    UNIX WebInstallDir/util/monitor -start WebAppname

    Windows WebInstallDir\util\monitor -start WebAppname

  3. Type in the URL in your browser:

    At this point, you have started up the Panther web application server. The client screen appears.

If the phrase "No service requested!" is displayed then you have successfully configured the web application server.

If you make any changes to the web initialization (WebAppname.ini) file, you must stop and restart the Panther web application server to have the changes take effect. Stopping the web application server is described in the next section.

Shut down the server

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

  1. Shut down the web application server:

    UNIX WebInstallDir/util/monitor -stop WebAppname

    Windows WebInstallDir\util\monitor -stop WebAppname

What did you do?

In this lesson, you performed these tasks:

What did you learn?

You learned: