Start of change

WEB CLOSE

Closes a connection to a server for CICS® as an HTTP client.

Read syntax diagramSkip visual syntax diagram
WEB CLOSE

>>-WEB--CLOSE--SESSTOKEN(data-value)---------------------------><

Conditions: NOTOPEN

This command is threadsafe.

Description

WEB CLOSE enables an application program to close a connection with a server. The session token identifies the connection that is to be closed. When the connection is closed, the session token that applies to it is no longer valid for use. The session token is required to receive a response from the server and to read the HTTP headers for the response, so the WEB CLOSE command should not be issued until all interaction with the server and with the response that it sends is complete. The command releases CICS resources involved with the connection.

The WEB CLOSE command does not cause CICS to notify the server that the connection should be terminated. It only makes CICS close the connection on the client side. On the final request that you make using the connection, you should specify the CLOSESTATUS(CLOSE) option on the WEB SEND or WEB CONVERSE command. When this option is specified, CICS writes a Connection: close header on the request, or, for a server at HTTP/1.0 level, omits the Connection: Keep-Alive header. The information in the headers means that the server can close its connection with you immediately after sending the final response, rather than waiting to see if you send further requests before timing out.

The connection might also be closed at the request of the server before the WEB CLOSE command is issued. If you need to test whether the server has requested termination of the connection, use the WEB READ HTTPHEADER command to look for the Connection: close header in the last message from the server.

If the server does request termination of the connection, the data relating to that connection is still kept available within CICS until the WEB CLOSE command is issued. The available data includes the most recent message received from the server, and the parameters used to open the connection (such as the scheme and the host name of the server). When a server has terminated the connection, the application program cannot:
  • Send further requests on that connection, using the WEB SEND or WEB CONVERSE commands.
  • Write HTTP headers, using the WEB WRITE HTTPHEADER command.
However, the application program can still:
  • Receive a response, using the WEB RECEIVE command.
  • Examine HTTP headers, using the WEB READ HTTPHEADER and HTTP header browsing commands.
  • Extract connection information, using the WEB EXTRACT command.
When the WEB CLOSE command is issued, the data relating to the connection is cleared.

If the WEB CLOSE command is not issued by the application program, then at end of task CICS clears the data relating to the connection and closes the connection, if it has not already been closed.

Options

SESSTOKEN(data-value)
specifies the session token, an 8-byte binary value that uniquely identifies a connection between CICS and a server. This value is returned by a WEB OPEN command for CICS as an HTTP client. When you issue the WEB CLOSE command for the connection identified by the session token, CICS ends that connection and clears the data associated with it, and makes the session token invalid for further use by the application program. "Session tokens" in the CICS Internet Guide explains the use of the session token.

Conditions

NOTOPEN
RESP2 values are:
27
Invalid session token.
End of change