RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


SOA: Refactoring Mainframe Applications into Dynamic Web Applications, Part 2

By refactoring your mainframe applications into Web services, you separate presentation from logic, and gain the ability to reuse mainframe data in Web applications. The second part of this two-part article completes the refactoring by showing you how to build a browser front-end that uses the XMLHttpRequest object to query the mainframe services exposed through the new Web interface described in Part 1.


his article is the second of a two-part series discussing how to use service-oriented techniques to refactor a mainframe application into deployable Web services within a standard Java servlet framework. The first part discussed how to apply SOA to a mainframe-dependent system. This part completes the discussion by showing how to use XMLHttpRequest background requests from a browser to invoke the Web services and provide data directly to the client application from the mainframe rather than screen-scraping and reformatting to provide data to a desktop application.

First, here's a brief recap of the high-level application architecture design.

A Review of the Application Architecture
For this article, the application framework follows a four-tier design, including a client tier, an application tier, a business tier, and an integration tier. Each tier serves to support different functionality within the overall framework, as shown in Figure 1:

The Integration Tier
The integration tier defines objects, components, and adapters that allow easy integration with enterprise information systems.

The Business Tier
The business tier defines objects, components, and services that encapsulate business logic for a given enterprise. You expose this business logic publicly as services to take advantage of SOA's benefits.

Figure 1. The Application Framework: Each tier shown in the diagram supports different functionality within the overall framework.
The Application Tier
The application tier consists of one or more FrontController servlets that handle incoming HTTP requests; dispatch the requests to services that execute business-domain logic; format the responses for the client devices; and return the formatted responses. The model-view-controller (MVC) pattern is followed to ensure a clear separation of concerns.

You can see a complete discussion of the FrontController and its implementation in the first part of this article, but basically, the FrontController supports a push-styled, event-driven model that makes the framework more responsive and dynamic. The class assumes that each incoming event has been initiated from a client device driven by the XMLHttpRequest object, which resides in the client tier.

The Client Tier
The client tier for this article consists of a simple HTML page with one form that's used to retrieve a list of users from the server. The form contains two TEXTAREA fields and two buttons—"Submit" and "Reset." The Reset button simply clears the form. The Submit button calls a JavaScript function that makes a request to a URL pointing to the FrontController.

The Application
The goal for the sample application accompanying this article is to retrieve a list of users from a mainframe system and display it in a browser without using screen scraping technologies. More generally, you can use the techniques discussed here to apply XMLHttpRequest object techniques to any browser-based application to take advantage of background-request data-refreshing without redrawing the entire browser window. For the sake of simplicity and clarity, the HTML page used to display the list of users in the sample application contains two TEXTAREA fields; one for displaying the list of users and one to display the raw data returned from the server.

Figure 2. The User Form. This sample form lets you make background requests via the XMLHttpRequest object from a browser to the FrontController servlet and then displays the results.
The FrontController class dispatches each request sent to the server to a UserAccount service containing the business logic that obtains the list of users. The UserAccount service interacts with the mainframe system using resource adapters.

After retrieving the list of users from the mainframe system, the UserAccount service returns the list to the FrontController class, which formats the response and returns it to the browser. The FrontController class handles each request/response in a simple model-view-controller manner.

Figure 2 illustrates the sample user form running in a browser.

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date