執行 Web 範例

您可以執行 Web 範例,以瞭解 Java 程式如何使用 CICS Web 支援來與 Web 瀏覽器互動。

開始之前

請確保已配置 CICS 區域,如執行 JCICS 範例所述。執行 Web 範例之前,請遵循中的指示。使用程式範例 DFH$WB1A(組譯器)或 DFH$WB1C (C),確認已正確配置 CICS Web 支援。

關於這項作業

此範例示範如何使用 JCICS Web 及文件類別。您可以從 Web 瀏覽器存取這個應用程式範例。此範例取得入埠用戶端要求、HTTP 標頭,以及交易的 TCP/IP 性質等相關資訊。此資訊寫入標準輸出串流 System.out,並插入回應文件。也會取得文件的相關資訊,並寫入 System.out,再插入回應文件。然後將回應文件傳送至用戶端。

此範例使用下列 Java 類別及程式:

程式 Java 類別
DFJ$JWB1 Web.Sample1

程序

  1. 啟動 Web 瀏覽器,然後以絕對路徑 /CICS/CWBA/DFJ$JWB1 輸入連接至 CICS 的 URL。 CICS 將下列回應文件傳回給 Web 瀏覽器:
    Web Sample1
    
    Inbound Client Request Information:
    
    Method: GET
    
    Version: HTTP/1.1
    
    Path: /cics/cwba/jcicxsa1
    
    Request Type: HTTPYES
    
    Query String: null
    
    HTTP headers:
    
    Value for HTTP header User-Agent is 'Mozilla/4.75 €en€ (WinNT; U)'
    
    Browse of HTTP Headers started
    
    Name: Host Value: winmvs2d.hursley.ibm.com:27361
    
    Name: Connection Value: Keep-Alive, TE
    
    Name: Accept Value: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png,
          */*
    
    Name: Accept-Encoding Value: gzip
    
    Name: Accept-Language Value: en
    
    Name: Accept-Charset Value: iso-8859-1,*,utf-8
    
    Name: Cookie Value: PBC_NLSP=en_US
    
    Name: TE Value: chunked
    
    Name: Via Value: HTTP/1.0 sp15ce18.hursley.ibm.com (IBM-PROXY-WTE-US)
    
    Name: User-Agent Value: Mozilla/4.75 €en€ (WinNT; U)
    
    Browse of HTTP Headers completed
    
    TCPIP Information:
    
    Client Name: sp15ce18.hursley.ibm.com
    
    Server Name: winmvs2d.hursley.ibm.com
    
    Client Address: 9.20.136.28
    
    ClientAddrNu: 9.20.136.28
    
    Server Address: 9.20.101.8
    
    ServerAddrNu: 9.20.101.8
    
    Clientauth: NO
    
    SSL: NO
    
    TcpipService: HTTPNSSL
    
    PortNumber: 27361
    
    Document Information:
    
    Doctoken: 33 92 112 0 0 0 0 1 64 64 64 64 64 64 64 64
    
    Docsize: 2762  
  2. 檢查 zFS 中的標準輸出串流。 範例將參考訊息寫入標準輸出串流 System.out,並將錯誤訊息寫入標準輸出串流 System.err。下面是寫入 System.out 輸出串流的輸出範例:
    Sample1 started
    Method: GET (3)
    Version: HTTP/1.1 (8)
    Path: /cics/cwba/jcicxsa1 (19)
    Request Type: HTTPYES
    Value for HTTP header User-Agent is 'Mozilla/4.75  en  (WinNT; U)'
    HTTP headers:
    Name: Host (4)
    Value: winmvs2d.hursley.ibm.com:27361 (30)
    Name: Connection (10)
    Value: Keep-Alive, TE (14)
    Name: Accept (6)
    Value: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */* (67)
    Name: Accept-Encoding (15)
    Value: gzip (4)
    Name: Accept-Language (15)
    Value: en (2)
    Name: Accept-Charset (14)
    Value: iso-8859-1,*,utf-8 (18)
    Name: Cookie (6)
    Value: PBC_NLSP=en_US (14)
    Name: TE (2)
    Value: chunked (7)
    Name: Via (3)
    Value: HTTP/1.0 sp15ce18.hursley.ibm.com (IBM-PROXY-WTE-US) (52)
    Name: User-Agent (10)
    Value: Mozilla/4.75  en  (WinNT; U) (28)
    Client Name: sp15ce18.hursley.ibm.com (24)
    Server Name: winmvs2d.hursley.ibm.com (24)
    Client Address: 9.20.136.28 (11)
    ClientAddrNu: 9.20.136.28
    Server Address: 9.20.101.8 (10)
    ServerAddrNu: 9.20.101.8
    Clientauth: NO
    SSL: NO
    TcpipService: HTTPNSSL
    PortNumber: 27361
    Doctoken: Doctoken: 33 92 112 0 0 0 0 1 64 64 64 64 64 64 64 64
    Docsize: 2762
    Sample1 complete