| Introduction to the World-Wide Web |
| |
This appendix consists of a set of worked examples for debugging and
deployment of NetExpress developed applications on different Web servers.
This appendix contains some worked examples, showing you how to deploy and
debug one of the sample applications supplied with NetExpress on different
Web servers. It is a supplement to the information in the chapter
Deploying
Your Application.
Even if the Web server you want to use is not covered in this chapter, the
general principles are the same on all servers, and following through one of
the worked examples might be helpful.
This section contains a worked example which shows you how to deploy one
of the sample Form Designer applications included in NetExpress. The example
shows you how to:
- Set up new Web shares, with different names to the NetExpress defaults
of COBOL and CGI-BIN.
- Modify your application to use the new Web share names
- Rebuild the application as an ISAPI with the shared run-time
- Copy the application to the Web server
You can take a simpler route when deploying applications. For example, if
you used the default NetExpress Web share names, you wouldn't need to modify
the share names used by the application. And if you didn't want to use ISAPI
or the shared run-time, you wouldn't need to rebuild the application.
This example shows you how to deploy the one of the sample applications
included with NetExpress as an ISAPI on Microsoft Internet Server.
B.1.1.1 Setup the Web Shares on Internet Server
In this section you create separate Web shares for all the parts of your
application.
- Use the Windows Explorer to create a new folder, called netxapps.
- Create four subfolders of netxapps:
- Start the Internet Service Manager.
- Double-click on the WWW process in the Microsoft Internet Service
Manager window.
- Click the Directories tab on the WWW Service Properties dialog box.
- Create a new Web share, nx-bin, for storing the binary files:
- Click the Add button.
- Enter x:\netxapps\nx-bin in the Directory field, where
x is the drive you created the folder in step 1.
- Enter nx-bin in the Alias field.
- Set the Access properties to Execute only (uncheck the Read checkbox
and check the Execute checkbox).
- Click the OK button.
- Create two more shares, both with Read permission only:
- Alias nx-html, directory x:\netxapps\nx-html
- nx-img, directory x:\netxapps\nx-img
B.1.1.2 Create a Deployable Version of the Application
First copy the application sources into a deployment directory on your
development machine.
- Change the Action property on the input form:
- Right-click on bevord_h.htm in the left-hand pane of the
Project window, and click Edit on the context menu.
- Select the form on the page, click the Action property, and amend it
to read:
/nx-bin/bev_h.dll
- Save bevord_h.htm, and quit Form designer.
Rebuild the application as an ISAPI:
- Change the executable file from an .exe to a .dll:
- Right-click on bev_h.exe in the left-hand pane of the Project
window, and click Remove from Build Type on the context menu.
- On the Remove from Build Structure dialog, uncheck Remove the whole
build structure, and select Remove this target from all build types, then
click the Delete button.
- Right-click on bev_h.obj in the left-hand pane of the Project
window, and click Package Selected Files, Dynamic Link Library
on the context menu.
- Click the Create button on the Define New Dynamic Link Library
dialog box.
- Change the Build Settings for the program:
- Right-click on bev_h.dll in the left-hand pane of the Project
window, and click Build Settings on the context menu.
- Click the Link tab, and select the Shared and Multi-threaded
radio buttons, and make sure the Dynamic checkbox is checked. .
- Click the Close button.
- Add a SET statement to compile this program for ISAPI:
- Right-click on bev_h.cbl in the left-hand pane of the Project
window, and click Edit on the context menu.
- Add the following statement to the top of the program, after the $SET
PREPROCESS directive (preprocessor directives must be in the first SET
statement in a program):
$set webserver(isapi) case reentrant(2)
The $ character must be in column 7.
- Save the changes and close the file.
- Rebuild the program.
B.1.1.3 Deploy the application
You can now deploy the application on the Web server:
- Copy the .dll file to x:\netxapps\nx-bin
- Copy bevord_h.htm and bevsum_h.htm to x:\netxapps\nx-html
Now run the application:
The next three subsections are worked examples showing you how to animate
one of the supplied example programs on different Web servers. The examples
show you how to:
- Animate a CGI on Microsoft Internet Server
- Animate an ISAPI on Microsoft Internet Server
- Animate an NSAPI on Netscape FastTrack
All of these examples were written using Windows NT Server as the
operating system.
The instructions below show you how to animate the HTML beverage
application in NetExpress, using Microsoft Internet Server running on Windows
NT Server.
To reconfigure Internet Server:
- Start the Microsoft Internet Service Manager.
- Select the WWW service and click Service Properties on the Properties
menu to display the WWW Service Properties dialog box.
- On the Service tab, deselect the Allow Anonymous checkbox.
Note: This forces users accessing this Web server from other
machines to supply a password and user name. You need to disallow anonymous
logons so that the Web server has sufficient permission to run the animator.
Depending on how your operating system and Web server have been set up,
you may also have to select either the NT Challenge/Response, or Basic (Clear
Text) check box. Use NT Challenge/Response if your Web browser is Microsoft
Internet Explorer; Basic if your Web browser is Netscape Navigator.
Do this if after following these instructions your CGI runs, but doesn't
animate.
- Click the directories tab on the WWW Service Properties dialog box.
- Remove any existing COBOL and CGI-BIN shares (click on
share and click Remove button).
- Add a share for COBOL, pointing to the source directory for the
application:
- Click the Add button to display the Directory Properties
dialog box.
- In the Directory field, enter:
x:\netexpress\base\demo\bevord_h
where x: is the drive where you installed NetExpress.
- In the Alias field, enter:
COBOL
- Set the Access permissions to Read.
- Click OK.
- Add a share for CGI-BIN, pointing to the source directory for the
application:
- Click the Add button to display the Directory Properties
dialog box.
- In the Directory field, enter:
x:\netexpress\base\demo\bevord_h\debug
where x: is the drive where you installed NetExpress. If you haven't
built this project before, this directory won't yet exist, causing a
server error when you apply these changes. If this is the case, use
Windows Explorer to create a debug folder in the location given
above, before you click OK below to apply these changes.
- In the Alias field, enter:
CGI-BIN
- Set the Access permissions to Execute.
- Click the OK button.
- Click OK to apply the changes to the Web server.
Rebuild and animate the application:
- Start NetExpress and load the bevord_h.app demo.
- Reconfigure NetExpress not to use Solo:
- Click Execute on the Options menu.
- Deselect Use the Solo Webserver for CGI projects checkbox.
- Click the OK button.
- Change the URL to start the application from the one used by Solo to the
one needed by the Web server:
- Click Properties on the Project menu.
- Change the contents of the Start Animating At field to:
http://servername/COBOL/bevord_h.htm
where servername is the name you use to access this Web
server.
- Click the OK button.
- Click Rebuild on the Project menu to build the
application.
- Click Start Animating on the Animate menu to run the
application.
- Click the Brew it! button on your Web browser, to run the CGI.
This starts the animator.
The instructions below show you how to animate an ISAPI version of the
HTML beverage application in NetExpress, using Microsoft Internet Server V3.0
running on Windows NT. This is split into the following stages:
- Configuring the Web server
- Rebuilding the program as an ISAPI .dll
- Animating the program
To configure the Web server:
- Start the Microsoft Internet Service Manager.
- Select the WWW service and click Service Properties on the Properties
menu to display the WWW Service Properties dialog box.
- On the Service tab, deselect the Allow Anonymous
checkbox.
This disallows anonymous logons; it means that users attempting to
access this Web server from another machine must supply a user name and
password. You need to do this or the Web server is unable to start the
NetExpress debugger.
Depending on how your operating system and Web server have been set up,
you may also have to select either the NT Challenge/Response, or Basic
(Clear Text) check box. Use NT Challenge/Response if your Web browser is
Microsoft Internet Explorer; Basic if your Web browser is Netscape
Navigator.
Do this if after following these instructions your CGI runs, but doesn't
animate.
- Click the Directories tab on the WWW Service Properties dialog
box.
- Remove any existing COBOL and CGI-BIN shares (click on
share and click Remove button).
- Set up the NetExpress source directory as a Web share named COBOL:
- Click the Add button to display the Directory Properties
dialog box.
- In the Directory field, enter:
x:\netexpress\base\demo\bevord_h
where x: is the drive where you installed NetExpress.
- In the Alias field, enter:
COBOL
- Set the Access permissions to Read.
- Click the Apply button.
- Set up the NetExpress executable directory as a Web share named CGI-BIN:
- If you haven't built this project before the executable directory
won't yet exist. Use Windows Explorer to browse folder x:\netexpress\base\demo\bevord_h\
(where x: is the drive where you installed NetExpress). If this does not
contain a subfolder, named debug, use Windows Explorer to create a
new folder named debug.
- Click the Add button to display the Directory Properties
dialog box.
- In the Directory field, enter:
x:\netexpress\base\demo\bevord_h\debug
- In the Alias field, enter:
COBOL
- Set the Access permissions to Read.
- Click the Apply button.
To rebuild the program as an ISAPI .dll:
- Load the project bevord_h.app into the NetExpres IDE.
- Change the project build information to create bev_h.dll instead
of bev_h.exe:
- Right-click on bev_h.exe in the left-hand pane of the Project
window, and click Remove from Build Type on the context menu.
- On the Remove from Build Structure dialog, uncheck Remove the
whole build structure, and select Remove this target from all
build types, then click the Delete button.
- Right-click on bev_h.obj in the left-hand pane of the Project
window, and click Package Selected Files, Dynamic Link Library
on the context menu.
- Click the Create button on the Define New Dynamic Link Library
dialog box to add bev_h.dll to the project list.
- Change the Build Settings for the .dll file to use the shared
multi-threaded run-time system:
- Right-click on bev_h.dll file on the left-hand pane of the
NetExpress Project window, and click Build Settings on the context
menu.
- Click the Link tab.
- Click the Shared and Multi-Threaded radio buttons, and
make sure the Dynamic checkbox is checked.
- Click the Close button.
- Add compiler directives to build this program as an ISAPI. Add the
following statement to the top of bev_h.cbl, following the $SET
statement which is already there:
$set webserver(isapi) case reentrant(2)
The dollar sign ($) must be in column 7 of your source code.
- Add the statement to start the debugger when the program is executed:
- Double-click bev_h.cbl in the project window to load it into a
text edit pane.
- Locate the program's Procedure Division.
- Add the following statement to the start of the Procedure Division:
call "CBL_DEBUGBREAK"
- Click Rebuild on the Project menu to build the ISAPI
program.
- Modify the input form's Action property so that it calls bev_h.dll
instead of bev_h.exe:
- Double-click on bevord_h.htm to start Form Designer and load
the page.
- Select the form, click on the Action property and change it to:
CGI-BIN/bev_h.dll
- Save the page and quit Form Designer.
- Quit the NetExpress IDE.
Now you can animate the program:
- Start your Web browser.
- Enter the URL for the first page in the application:
http://machinename/cobol/bevord_h.htm
where machinename is the name of your machine used by the Web
server.
- Click the Brew It! button on the form.
A dialog box appears, asking you whether or not you want to debug the
application.
- Click the Yes button.
The IDY File Error dialog box appears, because the debugger does not
know where to find the .idy files needed for debugging.
- Click the Browse button, and use the Open dialog box to locate
bev_h.idy file for the program. NetExpress creates this in the same
directory as the executable files for your application.
You can now debug the program.
If you stop the debugger, you also stop the Web server and must restart
it. When you step through an exit program statement, the NetExpress IDE
remains open, but the debugger stops operating until you execute the program
again. Because the server keeps the .dll file open while running, you
have to shut down the Web server to rebuild it.
The instructions below show you how to animate an NSAPI version of the
HTML beverage application in NetExpress, using Netscape FastTrack running on
Windows NT. The process is split into the following stages:
- Configuring the Web server
- Rebuilding the program as an NSAPI .dll
- Animating the program
To configure the server:
- Click Netscape, Administer Netscape Servers on the
Windows Start menu.
- Add a COBOL share to the Web server:
- Click Content Mgmt in the top frame.
- Click Additional Document Directories in the left-hand frame.
This displays the Additional Document Directories form.
- Enter COBOL in the URL field
- Enter the full path to your project's source code directory in the
Alias field.
- Click the OK button.
This displays the Save and Apply changes page.
- Click the Save and Apply button on the Save and Apply page.
Note: For NSAPI applications, you don't need to add a CGI-BIN
share for the NSAPI program to be found. NSAPI programs are loaded when the
Web server starts, using an explicit path set up in the server
configuration files.
- Modify the server's configuration files to load your NSAPI program, and
to define a new MIME type for it.
- Locate the Netscape server file obj.conf, and load it into a
text editor.
This file is in \netscape\server\httpd-name\config
where name is the server name for your machine.
- Add the following line to load your server-side program when the
server is started:
Init fn="load-modules" shlib="x:/netexpress/base/demo/debug/bev_h.dll"
funcs="beverage"
where x is the drive where you installed NetExpress.
- Between the <OBJECT name="default"> and <OBJECT>
tags, add the following line to associate the entry-point for your program
with a new MIME type, which we will call bev:
Service fn="beverage" method="(GET|POST)" type="magnus-internal/bev"
- Edit mime.types (this is in the same directory as obj.conf)
to associate the new MIME type you have just defined with an extension. Add
the following line to mime.types: Define the extension for
magnus-internal/bev as cobolcgi.
type=magnus-internal/bev exts=cobolcgi
A Browser request for beverage.cobolcgi will now start bev_h.dll
running.
- Click the Apply button on the top frame of the Netscape Server
Administration browser.
This displays the Apply Changes field.
- Click the Load Configuration Files button.
To rebuild the program as an NSAPI:
- Load the project bevord_h.app into the NetExpres IDE.
- Change the project build information to create bev_h.dll instead
of bev_h.exe:
- Right-click on bev_h.exe in the left-hand pane of the Project
window, and click Remove from Build Type on the context menu.
- On the Remove from Build Structure dialog, uncheck Remove the
whole build structure, and select Remove this target from all
build types, then click the Delete button.
- Right-click on bev_h.obj in the left-hand pane of the Project
window, and click Package Selected Files, Dynamic Link Library
on the context menu.
- Click the Create button on the Define New Dynamic Link Library
dialog box to add bev_h.dll to the project list.
- Change the Build Settings for the program to use the shared
multi-threaded run-time system, and to link in the modules and libraries
needed for NSAPI:
- Right-click on bev_h.dll file on the left-hand pane of the
NetExpress Project window, and click Build Settings on the context
menu.
- Click the Link tab.
- Click the Shared and Multi-Threaded radio buttons, and
make sure the Dynamic checkbox is checked.
- Select Advanced from the Category drop-down.
- Type accnsapi.obj in the Link with these OBJ's field.
Three different versions of this file are supplied - you need to use
different versions to go with different Netscape Servers.
- FastTrack
The default version of accnsapi.obj is set up for FastTrack,
so you don't need to change it.
- Commerce Server
Rename the default version of accnsapi.obj (in your \netexpress\base\lib
directory) so that you can keep a backup, and then rename accnscs.obj
toaccnsapi.obj .
- Enterprise Server
Rename the default version of accnsapi.obj (in your \netexpress\base\lib
directory) so that you can keep a backup, and then rename accenter.obj
to accnsapi.obj .
- Type libhttpd.lib in the Link with these LIB's field
(you would use httpd.lib for Commerce Server).
- Copy libhttpd.lib to a location where it can be found by the
NetExpress compiler.
This file is in a subdirectory of the one your Netscape server software
is installed: \server\nsapi\examples. Copy libhttpd.lib
from here to x:\netexpress\base\bin (where x:
is the drive where you installed NetExpress).
- Add compiler directives to build this program as an NSAPI. Add the
following statement to the top of bev_h.cbl, following the $SET
statement which is already there:
$set webserver(nsapi,beverage) case reentrant(2)
The dollar sign ($) must be in column 7 of your source code.
- Add the statement to start the debugger when the program is executed:
- Double-click bev_h.cbl in the project window to load it into a
text edit pane.
- Locate the program's Procedure Division.
- Add the following statement to the start of the Procedure Division:
call "CBL_DEBUGBREAK"
- Click Rebuild on the Project menu to build the ISAPI
program.
- Modify the input form's Action property so that it calls bev_h.bdll
instead of bev_h.exe (we defined .bdll as the extension for
a new MIME type when setting up the server):
- Double-click on bevord_h.htm to start Form Designer and load
the page.
- Select the form, click on the Action property and change it to:
beverage.cobolcgi
- Save the form and quit Form Designer.
- Quit the NetExpress IDE.
- Load the program into the Netscape server. To do this, shut the server
down and restart it from Netscape Server Administration.
Now you can animate the program:
- Start your Web browser.
- Enter the URL for the first page in the application:
http://machinename/COBOL/bevord_h.htm
where machinename is the name of your machine used by the Web
server.
- Click the Brew It! button on the form.
A dialog box appears, asking you whether or not you want to debug the
application.
- Click the Yes button.
The IDY File Error dialog box appears, because the debugger does not
know where to find the .idy files needed for debugging.
- Click the Browse button, and use the Open dialog box to locate
bev_h.idy file for the program. NetExpress creates this in the same
directory as the executable files for your application.
You can now debug the program.
If you stop the debugger, you also stop the Web server and must restart
it. When you step through an EXIT PROGRAM statement, the NetExpress IDE
remains open, but the debugger stops operating until you execute the program
again. Because the server keeps the .dll file open while running, you
have to shut down the Web server to rebuild it.
Copyright © 1998 Micro Focus Limited. All rights reserved.
This document and the proprietary marks and names
used herein are protected by international law.
| Introduction to the World-Wide Web |
| |