Please enable JavaScript to view this site.

InterFormNG2 Manual

Navigation: Workflow > Workflow input types > IBM i Command input

Setup InterFormNG2 AS400 command API

Scroll Prev Top Next More

The second of the prerequisites for calling functions in InterFormNG2 via commands on the IBM i platform is, that you have setup the InterFormNG2 AS400 command API on the IBM i platform.

 

This needs to be setup in order to tell the commands how to reach the machine with InterFormNG2, that is to execute the commands.

 

You can edit the settings in the configuration file in the IFS: /iformng2/lib/ng2CommandAPI.properties, but it is recommended to copy the file to the directory: /iformng2/user first, and then edit the file in /iformng2/user.

 

There are 3 reasons, why it is a good idea to copy the file to the /iformng2/user directory:

 

1.The file in the directory, /iformng2/lib will be overwritten when you upgrade InterFormNG2 in the future, but it will not be overwritten in the directory /iformng2/user

2.You have a backup of the original file just in case if your changed file gets corrupted.

3.You can add additional configuration files, that can be referenced on the AS400 command, NG2CMD in the parameter, configuration file (CFGFILE). That can be used for e.g. load balancing, if you partially want to run some commands via a different InterFormNG2 environment.

 

Remember to save a copy of the file before you edit the contents of the file, ng2CommandAPI.properties.

 

The shipped contents of the file is this:

 

# Configuration CommandAPI NG2

ng2CommandAPI.host=Localhost

ng2CommandAPI.port=8086

ng2CommandAPI.scheme=http

ng2CommandAPI.tokenURL=/oauth/token

ng2CommandAPI.clientId=interform

ng2CommandAPI.clientSecret=xxxxxxxxxxxxxxxxxxxxxxxxxxx

ng2CommandAPI.user=default/home

ng2CommandAPI.password=password

 

 

The parameters are explained below:

 

ng2CommandAPI.host

The IP-address or host name of the server where InterFormNG2 is running. Localhost indicates the local IBM i on which the NG2CMD command is run.

 

ng2CommandAPI.port

The port number used for accessing InterFormNG2. That need to match the port used in InterFormNG2. The default port is 8086. You need to open this port in the firewall on the other machine (e.g. running on Windows), where InterFormNG2 is running.

 

ng2CommandAPI.scheme

The scheme for the connection to InterFormNG2.

 

ng2CommandAPI.tokenURL

ng2CommandAPI.clientId

ng2CommandAPI.clientSecret

Just use the supplied values. Do not change them.

 

ng2CommandAPI.user

The user in InterFormNG2 that is used as credential, when the command signs on to InterFormNG2. The user is setup as the user name followed by / and the tenant e.g. home.

The user must be defined in the tenant and can the user role can e.g. be a web service or another role.

 

ng2CommandAPI.password

The password in InterFormNG2 for the user mentioned in the ng2CommandAPI.user field above.

 

The settings above only affect the green screen commands of InterFormNG2, not the core InterFormNG2.

 

Optional timeout values

Apart from the key/value pairs above you can also add these for setting the time out values, when the NG2CMD command is called. They are all set to the number of seconds to wait for a time out.

 

# TimeOuts

ng2CommandAPI.ConnectTimeOut=30

ng2CommandAPI.SocketTimeout=30

ng2CommandAPI.LoginTimeOut=30

 

The keys are:

ng2CommandAPI.LoginTimeOut

Used during technical-login and to get an access token.

 

ng2CommandAPI.ConnectTimeOut

Sets the maximum connection time when sending "command data" to NG2

 

ng2CommandAPI.SocketTimeout

Maximum waiting time for NG2-server response before timeout.

 

 

The setup above use an http connection to the InterFormNG2 server. The http settings on the IBM i must match the http (or https) settings on the other machine, that is connected.

 

 

Troubleshooting when trying to run NG2CMD via another server

If the command, IFORMNG2/NG2CMD does not work, when you are trying to execute via another machine running (gettting errors like STS9010), then you should consider the suggestions below (below it is assumed, that you want a setup where the NG2CMD command is to trigger InterFormNG2, which is running on a Windows machine, but the setup also works for other platforms):

 

Ensure, that the http or https setting on the other server match the setting on the IBM i. You should consider first to ensure, that the connection works with http before considering moving to https. If you (temporarily) want to move from https to http on the Windows machine, then you need to edit the file: C:\Program Files\InterFormNG2\application-default.properties and e.g. insert the character # in front of the lines, that are referring to ssl and set the value for jwt.secure.cookie to false like below:

 

# The format used for the keystore.

#server.ssl.key-store-type=PKCS12

# The path to the keystore containing the certificate

#server.ssl.key-store=keystore/interformng2.p12

# The password used to generate the certificate

#server.ssl.key-store-password=password

# The alias mapped to the certificate

#server.ssl.key-alias=interform

# JWT cookies should only be sent over HTTPS

jwt.secure.cookie=false

 

Then you need to restart the InterFormNG2 service on the windows machine.

 

Ensure, that the firewall on the Windows machine is open for input on the used port, which default is 8086.

 

Verify that the file, /iformng2/user/ng2CommandAPI.properties exist and contains the expected values. If this file does not exist, then the file, /iformng2/lib/ng2CommandAPI.properties is used. This file is however overwritten when you upgrade InterFormNG2 on the IBM i.

 

If you are still not able to make it work, then you should refer to the NG2 log file on the IBM i, which you can find it here in the IFS: /IformNG2/Log/NG2Tools.log.

 

If the NG2CMD command still does not work, then you can also verify the CFGFILE parameter of this command in your programs. You can here refer to a specific version of the file ng2CommandAPI.properties, which might have other settings than the standard files.

 

If you are getting random connection issues, then you can consider to increase the timeout values, which are set in the ng2CommandAPI.properties file with these settings:

ng2CommandAPI.ConnectTimeOut=30

ng2CommandAPI.SocketTimeout=30

ng2CommandAPI.LoginTimeOut=30

 

The values are set in seconds. That can especially be relevant, if you are processing larger input files.

 

Remember to restart the InterFormNG2 service whenever you change the settings file.