3 4 5 JSMX_COMMAND

LANSA Integrator

3.4.5 JSMX_COMMAND

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

Number

Symbolic Name

Description

1

JSMHDL

Input, character 4.

The JSMX_OPEN call returns the connection handle it assigns to this connection.  This handle is used on subsequent JSMX_COMMAND and other API calls to identify the connection to which the call applies.

2

JSMCMD

Input, character (variable, recommend 512).

Specifies the service command that is to be executed by the loaded service or a SERVICE_LOAD or SERVICE_UNLOAD command to load or unload a service.

3

JSMSTS

Output, character (variable, recommended 20).

The JSM server returns the status of the operation in this field.  The client application can test this field to determine whether the operation succeeded.  In most cases a status of 'OK' indicates successful completion.

4

JSMMSG

Output, character (variable, recommend 512).

The JSM server may return a message concerning the operation in this field - for example a completion message or an error message when the operation fails. Some service commands may return data related to the service in this field.

 

 

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.7 Command.

The JSMX_COMMAND has a number of:

RPGX Reserved Commands

RPGX Reserved Keywords

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