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:
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:
The settings above only affect the green screen commands of InterFormNG2, not the core InterFormNG2.
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:
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.
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.
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.