You must modify the Java™ application to retrieve
the callout requests in the hold queue and to handle the correlation of the response to the
appropriate request.
Prerequisite: Your WebSphere® Application Server administrator must configure a
shareable connection factory to be used by the Java application to retrieve the callout
requests.
The following steps are key steps in a Java
application for retrieving and responding to a synchronous callout request from IMS.
Procedure
-
To retrieve the synchronous callout request:
-
Set the interaction commit mode to 0 (COMMIT_THEN_SEND).
interactionSpec.setCommitMode(IMSInteractionSpec.COMMIT_THEN_SEND);
-
Set the interaction sync level to CONFIRM.
interactionSpec.setSyncLevel(IMSInteractionSpec.SYNC_LEVEL_CONFIRM);
-
Specify the callout queue name to the OTMA tpipe (hold queue) name.
// An 8-character name of the OTMA asynchronous hold queue that the
// messages are to be retrieved from
String calloutQueueName = new String (“CALLOUTQ”);
// Set the queue name for the callout messages
interactionSpec.setAltClientID(calloutQueueName);
-
Set the interaction verb to SYNC_RECEIVE_CALLOUT.
interactionSpec.setInteractionVerb(IMSInteractionSpec.SYNC_RECEIVE_CALLOUT);
-
Specify the type of callout request to retrieve: synchronous only (CALLOUT_REQUEST_SYNC),
asynchronous only (CALLOUT_REQUEST_ASYNC), or both (CALLOUT_REQUEST_BOTH).
The following example retrieves only synchronous callout request
messages.
// Specify to retrieve only synchronous callout request messages
interactionSpec.setCalloutRequestType(IMSInteractionSpec.CALLOUT_REQUEST_SYNC);
-
Specify the execution timeout value.
The following example sets the timeout value to 5
seconds.
interactionSpec.setExecutionTimeout(5000);
-
Execute the interaction.
The following example executes the interaction, and the request is returned as
calloutRequestMsg.
iteraction.execute(interactionSpec, null, calloutRequestMsg);
-
Obtain the correlation token from the IMSInteractionSpec instance.
The following example sets the timeout value to 5
seconds.
byte[] corrToken = interactionSpec.getSyncCalloutCorrelationToken();
-
Process the request.
In the previous example, the request is returned as calloutRequestMsg.
-
Send the response.
-
Set the interaction verb to SYNC_SEND.
interactionSpec.setInteractionVerb(IMSInteractionSpec.SYNC_SEND);
-
Set the correlation token to be sent back with the request.
interactionSpec.setSyncCalloutCorrelationToken(corrToken);
-
Execute the interaction.
The following example executes the interaction and sends the callout response message
(calloutRespondMsg).
iteraction.execute(interactionSpec, calloutRespondMsg, null);