The JSMX_COMMAND API is used to load and unload services and execute commands supported by the service.
The connection handle (JSMHDL) parameter identifies which connection is to execute the command – the connection handle must be first obtained by a call to JSMX_OPEN.
If the client application wishes to exchange variables or lists with the service, then it must call the JSMX_BINDFLD and/or JSMX_BINDLST APIs before calling JSMX_COMMAND.
Fields and lists bound using the JSMX_BINDFLD and JSMX_BINDLST APIs remain bound only for the duration of one JSMX_COMMAND call.
Parameters
|
A service is loaded before commands to the service are executed. A service is unloaded once you are finished using it. Only one service can be loaded at a time. Refer to 3.5 Command.
The JSMX_COMMAND has a number of:
For command services details, refer to Java Service Manager Services.
Technical Note
For a service to receive HTTP posted content, the SERVICE_CONTENT(*HTTP) keyword is required on the SERVICE_LOAD command.
If this is the first connection to use the SERVICE_CONTENT(*HTTP) keyword, then the posted HTTP content is read and sent to the service.
This connection takes responsibility for sending the HTTP response.
If this is NOT the first connection to use the SERVICE_CONTENT(*HTTP) keyword, then this connection only takes responsibility for sending the HTTP response. The SERVICE_LOAD command does NOT receive the HTTP content, but does receive the HTTP keywords.
When the connection that is responsible for the HTTP response uses the JSMX_CLOSE to close the connection, the returned byte array response becomes the HTTP response.
Only one connection can have responsibility for sending the HTTP response at a time.
HTTP content can only be read once.
HTTP response can only be written once.
HTTP keywords are always sent with the SERVICE_LOAD command.
Scenario A
#1 JSMX_OPEN - open connection
#2 JSMX_OPEN - open connection
#3 JSMX_OPEN - open connection
#1 JSMX_COMMAND( "SERVICE_LOAD SERVICE(xxx) SERVICE_CONTENT(*HTTP)" ) - send CGI keywords, read STDIN, claim ownership
#2 JSMX_COMMAND( "SERVICE_LOAD SERVICE(xxx)" ) - send CGI keywords
#3 JSMX_COMMAND( "SERVICE_LOAD SERVICE(xxx) SERVICE_CONTENT(*HTTP)" ) - send CGI keywords, transfer ownership
#1 JSMX_CLOSE - close connection
#2 JSMX_CLOSE - close connection
#3 JSMX_CLOSE - close connection and write STDOUT
Scenario B
#1 JSMX_OPEN - open connection
#1 JSMX_COMMAND( "SERVICE_LOAD SERVICE(xxx) SERVICE_CONTENT(*HTTP)" ) - send CGI keywords, read STDIN, claim ownership
#1 JSMX_CLOSE - close connection and write STDOUT
#2 JSMX_OPEN - open connection
#2 JSMX_COMMAND( "SERVICE_LOAD SERVICE(xxx)" ) - send CGI keywords
#2 JSMX_CLOSE - close connection
#3 JSMX_OPEN - open connection
#3 JSMX_COMMAND( "SERVICE_LOAD SERVICE(xxx) SERVICE_CONTENT(*HTTP)" ) - send CGI keywords, transfer ownership
#3 JSMX_CLOSE - close connection