When CICS® Web support is active in a CICS region, for CICS as an HTTP server, separate tasks are used to listen for inbound connection requests; to receive data from the socket and perform initial processing; and to cover work carried out by application programs in connection with a request. For CICS as an HTTP client, only one task applies, which is the task for the application program making the HTTP requests.
This is a long running CICS task. There is one instance of the Sockets listener task in a CICS system.
The task detects inbound TCP/IP connection requests on all ports defined to CICS, and invokes the CICS service associated with the port. When the port is intended for CICS Web support (that is, HTTP or USER is specified as the protocol), the Web attach task is defined as the transaction in the TCPIPSERVICE resource definition for the port, so the listener attaches that task.
When the TCPIPSERVICE definition for a port has the protocol HTTP, the default transaction ID for the Web attach task is CWXN. When the protocol is USER, the default is CWXU. An alias can be used instead, but the transaction always executes program DFHWBXN.
There is an instance of the Web attach task for each individual request from a Web client which is in the initial stages of processing. Before CICS Transaction Server for z/OS®, Version 3 Release 1, if a Web client and CICS had a persistent connection, the CWXN transaction would remain in the system for the duration of the persistent connection. Now, the CWXN transaction terminates after a request from the Web client has been passed to the alias transaction, or after the static response has been delivered. The Sockets listener task monitors the socket, and initiates a new instance of CWXN for each request on the persistent connection. This behavior, known as an asynchronous receive, avoids the possibility of a deadlock in a situation where the maximum task specification (MXT) has been reached, when a CWXN transaction remaining in the system would not be able to attach alias transactions to process further requests.
When a Web attach task has completed initial processing for a request, if an application-generated response is to be produced, the Web attach task attaches the alias transaction which is specified for the remaining processing stages of that request. CICS supplies a resource definition for a default alias transaction, CWBA. Alias transactions are not used where a static response is provided.
An alias transaction handles the processing stages for an application-generated response, which include receiving the request, executing the application's business logic, constructing the HTTP response and code page conversion of the HTTP response. If a converter program is used to process the request, it is also handled by the alias transaction. There is an instance of an alias transaction for each HTTP request which is in these stages of processing.
For CICS as an HTTP client, all activity caused by an application program that makes HTTP client requests is covered by a single task. This includes the application program's actions, the actions of CICS in sending requests and receiving responses, and socket activity. If the application program links to other programs using the EXEC CICS LINK command, these are also covered by the task. The task has the transaction ID that triggers the application program.
The task remains in the system from the beginning to the end of the application program's activity. The task may involve more than one request and response, and the application program may open and maintain more than one connection to a server. When the task ends, any open connections are automatically closed.