POCMasthead.gif (6305 bytes)

Web Access to CICS using Servlets - Overview



This overview section contains the following topics: 



Background

As you probably already know, corporate use of the World Wide Web (WWW) is exploding.   Web access to a company's CICS systems is becoming somewhat common.  Soon, the glass-house will be the front office for many companies.  If you haven't already read it, you should read IBM's e-business Application Framework.  The e-business Application Framework is IBM's vision of network computing, and includes web access to a company's existing data.  One part of the e-business Application Framework is the use of Java Servlets to access a company's data through CICS. 

[top


Audience

The intended audience for this article is a customer that wants to see a Java Servlet demo or wants to develop a proof-of-concept that shows a Java Servlet accessing  CICS. 

[top


Purpose

The purpose of this article is to provide information on Java Servlets, and directions to modify a Java Servlet (supplied with this article) that can be used as a proof-of-concept.  The Java Servlet supplied with this article provides access to backend CICS programs from a web browser. 

[top


Java Servlets

A Java Servlet is a Java program that runs inside of a Web server.  Since not all web servers are capable of  running Java Servlets, IBM has written a Servlet engine that can be used as a plug-in to most popular servers (see WebSphere Application Server below).  A Java Servlet is loaded into a web server and continues to run in the web server while it services browser requests.  When a request arrives at the web server (e.g. an HTML form) that is to be processed by a Servlet, the Web server delivers the request to the already running Servlet.  The Servlet looks at the request, does appropriate processing (in our case, it contacts CICS for information), then generates an HTML page (with the requested information) which is sent back to the web browser by the web server. 

Servlet advantages include: 

  • Once a servlet is started, it continues to run and does require a new process to be created (as with CGI processing).
  • Servlets are written in Java, a stable, secure language.
  • Servlets let you create complicated, high-performance, cross-platform Web applications without having to create multiple versions of your programs. You can take advantage of Java's "write-once, run everywhere" capabilities. 
[top

WebSphere Application Server

There are multiple products in the WebSphere family.  This paper is specifically directed toward the WebSphere Application Server.  There are multiple levels of WebSphere (Standard, Advanced, and Enterprise).  All levels of WebSphere can execute Servlets. 

The WebSphere Servlet engine is a web server plug-in that enables most major web servers to run Java Servlets.  Although WebSphere contains other components in addition to the Servlet engine, in this article, any references to WebSphere refers to the Servlet engine unless otherwise noted.  More information on the WebSphere Application Server can be obtained at http://www.software.ibm.com/webservers/index.html.  Your Servlet, running in the WebSphere Application Server, sends requests to CICS using a gateway that communicates Java requests to a CICS region via the CICS Client.  This gateway is called the CICS Transaction Gateway or the CICS Gateway for Java (the CICS Transaction Gateway is the follow-on to the CICS Gateway for Java). 

For more information on other WebSphere components, like the WebSphere Performance Pack which contains a load balancing component, a caching proxy server, and an enterprise file system (AFS), please see http://www.software.ibm.com/webservers/index.html

[top


Overview of the Supplied Servlet

flow.gif (5799 bytes)

The flow for web access to a CICS application using the supplied Java Servlet is as follows (note that this is not the only way that a Servlet can be used to access CICS, but this is the technique that was used in the sample program included in this SupportPac): 

The end user requests access to the Servlet by specifying the URL of the Servlet on their web browser.  The request flows to the web server that is running the Servlet under the control of WebSphere.  WebSphere creates a thread in the already running Servlet, and the browser request is passed to the new Servlet thread.  The Servlet analyses the request, calls a CICS program via the CICS Gateway for Java (CICS Transaction Gateway) and the CICS Client, then generates HTML containing the response received from the CICS program.  The web server then sends the HTML back to the web browser. 

The following series of panels would be seen by the user at the web browser: 

The user would specify the URL of the Servlet as in their web browser as shown below. 

user1.gif (6825 bytes)

This causes a request to flow to the web server.  The web server and the WebSphere Application Server create a thread in the already running Servlet and pass the request to the Servlet.  The Servlet looks at the request, finds that the user has not authenticated with a userid and password, and generates the HTML to solicit the user's userid and password.  Below is the result of the HTML that was sent back to the browser.  Note that the panel below has been filled in with a userid and password, and is ready to have the 'Signon' button pressed. 

user2.gif (18194 bytes)

After the Signon button is pressed, the form contained in the HTML is sent back to the web server.  The web server and WebSphere Application Server create a thread in the already running Servlet, and then passes the form data to the Servlet.  The Servlet calls a CICS program (via an ECI request through the CICS Transaction Gateway and CICS Client) to authenticate the userid/password combination which is passed via a COMMAREA.  The Servlet checks a return code in the returned COMMAREA to see if authentiction was successful.  If successful, the Servlet generates the HTML for employee name inquiries (shown below), otherwise, it generates the HTML to redisplay the signon panel.  The Servlet also stores the userid/password in a session object.  The web server sends the HTML to the web browser.  The panel below has been filled out with an employee number and is ready to have the 'Inquire' button pressed. 

user3.gif (17458 bytes)

After the Inquire button is pressed, the form contained in the HTML is sent back to the web server.  The web server and WebSphere Application Server create a thread in the already running Servlet, and then passes the form data to the Servlet.  The Servlet verifies that the user has already signed on, then calls a CICS program (via an ECI request through the CICS Transaction Gateway and CICS Client) to request the employee name associated with the supplied employee number.  Data is passed between the Servlet and CICS using a COMMAREA.  The Servlet generates HTML with the employee number (displayed on the panel shown below), or generates HTML with an appropriate error message if the employee number is not found.  The web server sends the HTML to the web browser.  From the panel below, the user could fill in another employee number and press the 'Inquire' button, press the logoff button, or make other web browser requests. 

user4.gif (18345 bytes)
 
 

[top


Supporting Software

Below is the supporting software used while writing, testing, and running the Java Servlet supplied with this SupportPac: 
  • Operating System -  You will need to run an Operating System capable of running a Web Server than can use the WebSphere Application Server plug-in (see below).  Although not required, you may run the CICS Transaction Gateway on the same machine.  A CICS Client will have to run on the same machine as your CICS Transaction Gateway. Windows NT Server 4.0 at SP3 was used to develop and test the Servlet included with the SupportPac.  This allowed a simple, self-contained environment.
  • Web Server - You will need a Web Server that can run WebSphere Application Server (see below).   There is a list of supported Web Servers at http://www.software.ibm.com/webservers/appserv/index.html.  Microsoft IIS V3 was used while developing and testing the accompanying Servlet.
  • WebSphere Application Server -   The WebSphere Application Server contains a Java Servlet engine software plug-in that allows your existing web servers (like the Lotus Domino Go Webserver, Apache Server, Microsoft IIS, and Netscape Enterprise Server) to run Servlets. The WebSphere Application Server home page is http://www.software.ibm.com/webservers/appserv/index.html.
  • CICS Transaction Gateway - The CICS Transaction Gateway can receive requests from Java Applets, Applications, and Servlets and change the requests to real ECI or EPI requests that are sent to CICS through a CICS Client.  If your Java Servlet is on the same machine as your CICS Client, you specify 'local' as the location of the CICS Transaction Gateway.  This allows the CICS Transaction Gateway classes that are used in your Servlet to communicate directly to a CICS Client without the need to run a separate CICS Transaction Gateway process (see diagram above).   The CICS Transaction Gateway home page is http://www.software.ibm.com/ts/cics/platforms/internet/cicsgw4j/index.html.  The CICS Transaction Gateway V3 was used while developing and testing the accompanying Servlet. 
  • CICS Client - The CICS Client request to run CICS programs or transactions to a CICS Server.  The CICS Client must be on the same machine as the CICS Transaction Gateway, or on the same machine as your Java Servlet if you specify local when you open a CICS Transaction Gateway connection.   The CICS Client home page is http://www.software.ibm.com/ts/cics/platforms/desktop/.   The CICS Universal Client for NT V3.0.2 was used while developing and testing the Servlet included with this SupportPac.
  • CICS Server - The CICS Server runs the backend programs. These programs usually access data controlled by CICS.  The home page for CICS is http://www.software.ibm.com/ts/cics/.   CICS for NT from TXSeries for NT was used.
  • Web Browser - You will need a web browser that is at a sufficient level to handle the HTML generated by the Java Servlet.  The HTML generated by the Servlet is very simple HTML, so older browsers should work fine.  Microsoft EI V4 and Netscape V4.5 were used.  The Netscape browser can be downloaded from http://www.netscape.com.
  • JDK - The Java Development Kit (JDK) contains tools needed to develop Java programs.  The Java compiler (javac) was used to compile the Java Servlet.  The JDK can be downloaded from http://java.sun.com. JDK 1.1.6 for Windows NT was used for the Servlet included with this SupportPac.
There is a later section that details the configuration/customization performed on the supporting software.  There is also a section that discusses installation of the supplied Java Servlet

[top


Last Modified On 01/19/99

[Home]    [Overview]    [Environment]     [Servlets]    [This Servlet]    [Summary]


[ Privacy ][ Legal ][ Search ][ Contact ]