On Windows, the server part of the Natural Web I/O Interface is implemented as a service.
This document covers the following topics:
The Natural Web I/O Interface service is installed with Natural for Windows if the corresponding option has been set during installation. This is part of the setup type Development Client for Single Point of Development. See the Installation documentation for further information.
The Natural Web I/O Interface service is installed as a Windows service. In the Windows Services management console, the service is listed as Software AG Natural n.n Web I/O Service. It is started automatically at Windows startup. By default, the service listens on the port number 2900. You can choose a different port number during installation.
The configuration of the Natural Web I/O Interface service is stored in the Windows registry. If you do not want to use the default values with which the Natural Web I/O Interface service has been installed, you can modify the service configuration as described below to meet your requirements.
The following topics are covered below:
The program nwosvcd.exe, which is stored in the Natural bin directory, is used to execute the service commands. The following service commands can be specified in the Command Prompt window of Windows:
Command | Description |
---|---|
nwosvcd
–help |
Shows all available Natural Web I/O Interface service commands and subcommands in a message box. |
nwosvcd
–install |
Installs the Natural Web I/O Interface service. The service is installed with the startup type Automatic. If you want to change the startup type, you must open the Windows Services management console. Under Windows XP, this is located in the Administrative Tools. Open the properties for Software AG Natural n.n Web I/O Service and select the desired startup type. |
nwosvcd
–remove |
Removes the Natural Web I/O Interface service from the system. |
nwosvcd
–console |
Runs the Natural Web I/O Interface service as a Windows console application. In this case, an icon appears in the notification area of the taskbar. When you invoke the context menu for this icon, the following commands are provided:
|
nwosvcd
–show |
Shows the configuration of the Natural Web I/O Interface service. |
nwosvcd -config
keys |
Changes the configuration of the Natural Web I/O Interface service. The following keys can be specified:
To remove any user exits from the configuration, enter the following command:
Once the configuration was changed, the Natural Web I/O Interface service must be restarted. |
Note:
The service commands are not case-sensitive. They can be
specified in both upper-case and lower-case.
This example explains how to create a new configuration with the port number 3344 and the user exit 1 C:\Program Files\My Company Name\User Exit1\libuserexit1.dll.
To start the Natural Web I/O Interface service with your own configuration
Open the Windows Services management console and stop the Natural Web I/O Interface service.
Invoke the Command Prompt window of Windows.
Go to the Natural bin directory which contains the file nwosvcd.exe.
Enter the following command to configure a new port number and a new user exit 1:
nwosvcd -config -port=3344 -userexit1="C:\Program Files\My Company Name\User Exit1\libuserexit1.dll"
Go back to the Windows Services management console and start the Natural Web I/O Interface service.
In order to start a Natural session, the Natural Web I/O Interface service executes a batch file. The batch file prepares the environment for the Natural session and eventually starts Natural. It must therefore contain all environment settings needed to run the Natural session.
The batch file receives certain parameters from the Natural Web I/O Interface client. The parameters can either be evaluated by the batch file itself or passed on to Natural. A client who wants to start a Natural session can specify the batch file to be used. The section Configuring the Client describes where and how this is done.
A sample batch file with the name nwo.bat is contained in the Natural bin directory. It has the following content:
@echo off set IPAddress="" set ClientID="" set Argument3="" set Argument4="" set NaturalParameters="" if not (%1)==(null) set IPAddress=%~1 if not (%2)==(null) set ClientID=%~2 if not (%3)==(null) set Argument3=%~3 if not (%4)==(null) set Argument4=%~4 if not (%5)==(null) set NaturalParameters=%~5 echo IPAddress=%IPAddress% >nwo.log echo ClientID=%ClientID% >>nwo.log echo Argument3=%Argument3% >>nwo.log echo Argument4=%Argument4% >>nwo.log echo NaturalParameters=%NaturalParameters% >>nwo.log natrt.exe %NaturalParameters% etid=$$
You can create your own batch files to start up Natural sessions. If you do so, you should make sure - as in the above sample batch file - to start Natural with natrt.exe. The above sample requires that the batch file is contained in the Natural bin directory. If this is not the case, you must specify an appropriate absolute or relative path to natrt.exe.
In order to refer to a specific batch file in the Natural Web I/O Interface client, you can specify either an absolute path or a relative path. If you specify a relative path, the batch file is searched according to the following rules:
In the directory where nwosvcd.exe is located. This is the Natural bin directory.
In the system directory. This is the directory that the system
function GetSystemDirectory
would deliver.
In the Windows directory. This is the directory that the system
function GetWindowsDirectory
would deliver.
In the directories that are listed in the
PATH
environment variable.
The batch file will receive the following arguments:
Order | Argument | Description |
---|---|---|
1 | IPAddress |
The client IP address from where the session is
opened.
Note: |
2 | ClientId |
The user name from the logon page is passed as the client ID. |
3 | Argument3 |
Reserved for future use. |
4 | Argument4 |
Reserved for future use. |
5 | NaturalParameters |
These can be any Natural parameters. The
parameters are either defined in the configuration file for the session, or
they are entered in the logon page. The following is an example of the
corresponding entry in the configuration file:
The language that is selected in the logon page is added as the first element to the Natural parameters in the form "ulang=x". |
Arguments 1 and 2 can be used to audit the client, to allow to run an application from a specific PC (identifying the IP address), to build statistics, to do special actions, etc.
In the batch file, several environment variables can be set for the Natural session that is started by the service:
- NWO_ENABLE_ACK=["YES"|"NO"]
This environment variable is used for asynchronous screens (
SET CONTROL N
).
YES When asynchronous screens are sent to the client, Natural will wait to receive an ACK package before the next screen can be sent. NO No waiting between asynchronous screens. Default value. - NWO_TIMEOUT=[number-of-seconds]
The maximum time, in seconds, that Natural waits to receive any input from the client before it closes the session. If the number of seconds is "0", Natural waits infinitely (no timeout). The default value is "0".
Error NAT5466 is returned at timeout. In Natural, the application can handle this error and decide how to continue or terminate.
The logging information system reports errors, warnings and/or session information, depending on the option that has been defined with the following Natural Web I/O Interface service command:
nwosvcd -config -logging=option
option can be one of the following:
Option | Description |
---|---|
E |
Error. When this option is specified, the Natural Web I/O Interface service reports only errors. In the case of an error, the service usually exits immediately. |
W |
Warning. When this option is specified, the Natural Web I/O Interface service reports errors and warnings for uncritical errors. In the case of a warning, the service continues to run. |
I |
Information. When this option is specified, the Natural Web I/O Interface service reports errors, warnings and information. The information messages allow to check the session parameters, IP address, etc. |
Help information, for example, on how to run, configure and install the Natural Web I/O Interface service is always provided. The messages which inform you when the service has been started or stopped are also part of the help information.
To find out which logging option is currently active, enter the following Natural Web I/O Interface service command:
nwosvcd -show
The logging messages are saved in the Windows Event Viewer.
SSL is used for a secure connection between the Natural Web I/O Interface server and the Natural Web I/O Interface client or Natural for Ajax. Server authentication cannot be switched off. A certificate and a private key is always required on the server.
To establish an SSL connection, you have to proceed as described in the following topics:
To create and use an SSL certificate and a private key on the server, proceed as described below.
Adapt the example configuration file openssl.cnf to your needs.
Note:
openssl.cnf and openssl
are delivered in %NATDIR%\%NATVERS%\bin.
Set the environment variable so that it points to the file openssl.cnf:
set OPENSSL_CONF=%NATDIR%\%NATVERS%\bin\openssl.cnf
Generate a certificate signing request:
openssl req –new > server.cert.csr
Generate a private RSA key:
openssl rsa –in privkey.pem –out server.cert.key
Generate a self-signed certificate:
openssl x509 –in server.cert.csr –out server.cert.crt –req –signkey server.cert.key –days 365
It is important that the name of the generated certificate is server.cert.crt and that the name of the generated private key is server.cert.key.
Note:
The certificate can be self-signed or it can be signed by a CA
(Certificate Authority) such as VeriSign.
Put the generated files into the same directory as the scripts which start the Natural Web I/O Interface server.
After you have created an SSL certificate and a private key as described above, proceed as follows:
Change the configuration of the Natural Web I/O Interface service using the following command:
nwosvcd -config -ssl yes
Restart the Natural Web I/O Interface service.
See also Configuring the Natural Web I/O Interface Service on Windows.
After you have configured the service as described above, you have to import the generated server.cert.crt file to a truststore on the client. For information on how to do this for the Natural Web I/O Interface client, see Configuring SSL. If you are using Natural for Ajax as the client, see Configuring SSL in the Natural for Ajax documentation.