Sample programs: pipelining requests to an HTTP server

Sample programs DFH$WBPA (assembler language), DFH$WBPC (C®), and DFH0WBPO (COBOL) demonstrate how CICS® can pipeline client requests to an HTTP server.

Before you begin

The sample programs send requests to a CICS region in which CICS web support is running. The requests are handled by the CICS-supplied sample program DFH$WB1C. Before you use the sample programs, set up a CICS region as an HTTP server, following the procedure described in Configuring CICS web support components . Complete the procedure by setting up the sample program DFH$WB1C and modifying the sample URIMAP definition DFH$URI1, as described in Verifying the operation of CICS web support. If your CICS region is already set up and operating as an HTTP server, and you have your own TCPIPSERVICE definitions, do not install the sample TCPIPSERVICE definition HTTPNSSL again; just set up DFH$WB1C and DFH$URI1.

About this task

When you have set up a CICS region as an HTTP server, complete the following steps to use the pipelining sample programs:

Procedure

  1. Identify the CICS region that will be the HTTP client.
    To try out the sample programs, you have three options:
    • You can use the same CICS region as both the server and the client; the requests will go out of and into the region as they do with two separate CICS regions, and the results are the same. In this case, no further CICS web support setup is required, because a CICS region that operates as an HTTP server can also operate as an HTTP client.
    • You can use a different CICS region as the client, which has already been set up for CICS web support. Again, in this case, no further CICS web support setup is required.
    • You can use a different CICS region as the client, which has not yet been set up for CICS web support. In this case, you must carry out some basic CICS web support setup, described in Step 2.
  2. Optional: If you are using a different CICS region as the HTTP client, and the region has not yet been set up for CICS web support, carry out basic setup:
    1. Enable TCP/IP support for the CICS region, following the instructions in Enabling TCP/IP in a CICS(r) region .
      This process includes setting up Communications Server and establishing access to a DNS, or domain name, server through z/OS®.
    2. Specify the system initialization parameter TCPIP=YES for the region to activate CICS TCP/IP services.
    This setup enables the CICS region to function as an HTTP client.
  3. In the CICS region that you set up as an HTTP server, identify the TCPIPSERVICE definition for a port that the client region can use to make its requests.
    Select any port that is defined with the HTTP protocol, but does not use SSL; that is, with a TCPIPSERVICE definition that specifies PROTOCOL(HTTP) and SSL(NO). You can choose any suitable port because the sample URIMAP definition DFH$URI1, which is used on the server to access the sample program DFH$WB1C, matches any host name and port number.
  4. In the HTTP client region, modify the supplied sample URIMAP definition DFH$URI2, which is provided in the DFH$WEB resource definition group.
    Because DFH$WEB is a protected group, copy the definition to another group to enable editing.
    DFH$URI2 is a URIMAP definition with a usage attribute of CLIENT. It specifies the components of the URL that the sample programs use to make the requests to the HTTP server region. Follow these steps to modify the sample:
    1. Do not change the scheme (SCHEME attribute) specified in DFH$URI2 as HTTP.
    2. The host (HOST attribute) specified in DFH$URI2 is a dummy host name. Modify this name to insert the real host name:
      • Specify the host name assigned to the z/OS image for the HTTP server region. If you do not know the host name, you can use the colon hexadecimal or dotted decimal IP address from the TCPIPSERVICE definition that you selected in Step 3.
      • If the TCPIPSERVICE definition that you selected is for a port number other than 80 (the well-known port number for HTTP), specify the port number from the TCPIPSERVICE definition after the host name, with a colon separating the host name and port number.
    3. Do not change the path (PATH attribute) specified in DFH$URI2 as /sample_web_app , which is matched by DFH$URI1.
  5. In the HTTP client region, install your modified URIMAP definition DFH$URI2.
  6. In the HTTP client region, install the PROFILE definition DFH$WBPF, which is provided in the DFH$WEB resource definition group.
  7. Translate and compile one of the sample programs in the required language.
    The pipelining sample programs are not compiled when you receive them. The sample programs are supplied in the SDFHSAMP library. The names of the sample programs and their corresponding transactions are as follows:
    Language Program Transaction
    Assembler DFH$WBPA WBPA
    C DFH$WBPC WBPC
    COBOL DFH0WBPO WBPO
  8. In the HTTP client region, install the PROGRAM resource definition and the corresponding TRANSACTION resource definition for your chosen sample program.
    The resource definitions are provided in the DFH$WEB resource definition group.
  9. In the HTTP client region, run the transaction for your chosen sample program.
    The sample program sends information messages to your terminal when it sends each of the three HTTP requests successfully, receives each of the three HTTP responses successfully, and completes. If any of the sends or receives fail, an error message is given instead. The content of the HTTP requests and responses is not displayed.
  10. When you have finished using the sample program, for security reasons disable the URIMAP definitions, DFH$URI1 and DFH$URI2, and uninstall the sample TCPIPSERVICE definition HTTPNSSL if you were using it.