The web server interface is located in the runtime/cgi subdirectory. To use it, copy the following files to the cgi-bin (or scripts for PWS or IIS) directory of your web server:
In your main knowledgebase object, you must have these minimal HTML elements which are inserted above and below all questions asked of the user:
Property Name | Minimal Value |
question_top |
<HTML> <HEAD></HEAD> <BODY> <FORM METHOD="POST" |
question_bottom |
<INPUT NAME="Submit" TYPE="Submit" VALUE="Continue"></INPUT> |
output_continue |
<FORM METHOD="POST" |
In addition, some jigs (notably Basic) also have an output_continue property in the knowledgebase object. This is used when there is output for the user and the reasoning process is not complete. That is, some intermediate results or information are being displayed for the user. In this case the output_continue contents are added to the web page and are an empty HTML form that continues the reasoning process. The program name used in question_bottom and output_continue must be the same and must match the name of the executable program in your cgi-bin directory.
To run your knowledgebase, type into your browser one of the following URLs:
Windows: http://127.0.0.1/cgi-bin/kwcgibasic.exe?[kb_file='hello.kb']
IIS: http://127.0.0.1/scripts/kwcgibasic.exe?[kb_file='hello.kb']Unix: http://127.0.0.1/cgi-bin/kwcgibasic?[kb_file='hello.kb']
Replace the 127.0.0.1 with the name (www.company.com) or IP address of the server you have installed the KnowledgeWright CGI script on.
There are additional parameters that you can specify in the square brackets. The full set of parameters are:
Parameter |
Description |
Examples |
kb_file |
The name of the knowledgebase file |
'amzi_website_advisor.kb' |
directory |
The directory where the kb_file is located. |
'c:\Netscape\SuiteSpot\cgi-bin' '/usr/local/apache/cgi-bin' |
temp_directory |
The directory where the temporary session files are created as well as log files (if you have specified one) and any other temporary files needed by KnowledgeWright. Note CGI programs must have write access to this directory. |
'c:\Netscape\SuiteSpot\cgi-bin\temp' '/usr/local/apache/cgi-bin/temp' |
log_file |
The name of the log file that details the execution. It will have the same contents as the log in the KnowledgeWright Workshop. |
'kwrun.log' |
KnowledgeWright includes a Windows test program called 'atestcgi.exe'. It can be used in two ways.
First, you can just run it from your browser by typing one of the following URLs:
Windows: http://127.0.0.1/cgi-bin/atestcgi.exe
IIS: http://127.0.0.1/scripts/atestcgi.exe
Run in this way, it will print out the current directory and then an error message about not being able to load atestcgi.xpl. This will let you determine if the 'cgi-bin' or 'scripts' directory is the current directory when KnowledgeWright is invoked. If it is not, see your system administrator.
Second, you can copy kwcgibasic.xpl and name it 'atestcgi.xpl'. Then run it again as specified above. You should get an error message saying there is no kb file specified. If you get any other message, there is a problem with your web server's configuration.
If the knowledgebase does not start-up correctly, check the knowledgebase object to ensure the program name being executed in question_top corresponds with your operating system. For example, using the Basic jig under Windows, the program name is 'kwcgibasic.exe' and under Unix it is 'kwcgibasic'. Also, some jigs also have an output_continue property. If so, ensure the program name specified there is correct.
The next thing to do when you encounter a problem is to specify a log_file in the query string where you invoke kwcgirun.exe. Study its contents, especially at the bottom to see if the problem is explained.
If that does not make the problem clear, the next step is to specify a log file in Amzi! Prolog + Logic Server. To do this, add the following lines to your amzi.cfg file in the cgi-bin directory:
apitrace = on logfile = c:\amziapi.log
If you need technical support, please e-mail both your KnowledgeWright log
file and Amzi! Logic Server trace file along with your knowledgebase to [email protected].
By default, Personal Web Server (PWS) and IIS, do not have a directory named "cgi-bin". Instead their is a directory named "scripts" under "wwwroot" and this is where you can run CGI programs from. However, the URL to invoke KnowledgeWright from scripts reads a like this:
Also by default PWS and IIS do not allow the execution of CGI programs. In order to allow this, you must enable "Execute" permission on your scripts directory. You can do this either by:http://127.0.0.1/scripts/kwcgibasic.exe?[kb_file='hello.kb']
You will also need to create a temporary directory (we recommend you put it outside the wwwroot subtree on a production server). Make sure your web server process has full access to that directory (to read, write, create and delete files). Then specify that directory as temp_directory when invoking your knowledgebase.
In order to use Apache with KnowledgeWright you need to set the LD_LIBRARY_PATH environment variable in your configuration file (normally apache/conf/httpd.conf) by adding the following line:
SetEnv LD_LIBRARY_PATH .
(note the lone period). If you already have set this variable, then make sure dot (.) is included in the list of directories. This is needed so that Apache can find libamzi.so and aosutils.lsx.
You will also need to create a temporary directory (we recommend you put it outside the htdocs and cgi-bin subtrees on a production server). Make sure your web server process has full access to that directory (to read, write, create and delete files). Then specify that directory as temp_directory when invoking your knowledgebase.