![]() |
Web Access to CICS using Servlets - Overview
This overview section contains the following topics:
BackgroundAs 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]
AudienceThe 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]
PurposeThe 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 ServletsA 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:
WebSphere Application ServerThere 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![]() 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.
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.
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.
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.
[top]
Supporting SoftwareBelow is the supporting software used while writing, testing, and running the Java Servlet supplied with this SupportPac:
[top]
Last Modified On 01/19/99 |
|