|
Use the WEB SEND command to make XCICS assemble the HTTP headers, entity body, status code and reason phrase for an HTTP response, carry out code page conversion, and transmit the response to the Web client.
Write any additional HTTP headers for the response using the WEB WRITE HTTPHEADER command before issuing the WEB SEND command, as described in "Writing HTTP headers for a response". Also produce any entity body that is needed for the message, as described in "Producing an entity body for an HTTP message".
You need to specify a status code and reason phrase on the WEB SEND command.
If wanted, the response can be sent in chunks (chunked transfer-coding).
When you issue the WEB SEND command:
| 1. | Specify the STATUSCODE option to select an appropriate status code for the response, depending on the situation, and the STATUSTEXT and STATUSLEN options to provide the reason phrase. XCICS does not validate your choice of status code, and it is the user application's responsibility to ensure that the value is valid and conforms to the rules for HTTP status codes. |
| 2. | Identify the source of any entity body for the response by specifying either the DOCTOKEN option, for a XCICS document that you have created, or the FROM option, for a body of data that you have assembled. If you are using the FROM option, specify the FROMLENGTH option to give the length of the entity body, or of the chunk if chunked transfer-coding is in use. For chunked transfer-coding, the DOCTOKEN option cannot be used. |
| 3. | Specify the media type for the body of the response, using the MEDIATYPE option. XCICS does not check the validity of the specification against the data content. There is no default. If you do not specify this, XCICS does not build a Content-Type header for the response. |
| 4. | If you want the message to be sent immediately, rather than at the end of the task (which is the default), specify IMMEDIATE for the ACTION
option. If you are using chunked transfer-coding, IMMEDIATE is the default, so there is no need to make this choice.
Note: Only one response can be sent during a task. This can be a standard response using one WEB SEND command, or a chunked response using a sequence of WEB SEND commands. |
| 5. | If you want to close the connection after sending the response, specify CLOSE for the CONNECTION option. XCICS writes a Connection: close header on the response, which notifies the Web client that the connection is closed and no more requests should be sent. (For a Web client at HTTP/1.0 level, XCICS achieves the same effect by omitting the Connection: Keep-Alive header.) |
| 6. | If you are using chunked transfer-coding (or chunking), in addition to the basic instructions in this topic, you need to follow the special instructions in "Using chunked transfer-coding to send an HTTP request or response". You need to ensure that the procedure described in that topic is followed correctly, so that the chunked message is acceptable to the recipient. Chunked messages are sent using several instances of the WEB SEND command, with particular options. |
|