Browse DevX
Sign up for e-mail newsletters from DevX


SOA: Refactoring Mainframe Applications into Dynamic Web Applications, Part 1 : Page 5

By refactoring your mainframe applications into Web services you separate presentation from logic, and gain the ability to reuse mainframe data in Web applications. This two-part article describes the complete process.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

The Application Tier
Multitier application interactions usually consist of an HTTP-based request passed from a client to an HTTP server that executes business-domain logic. The server formats the response from the business-logic object into some type of markup language (HTML, WML, XML, etc.) and passes that back to the client. The model-view-controller (MVC) pattern often embodies the interaction.

Using the MVC pattern to encapsulate client/server interactions helps to illustrate software-pattern roles as well as developer roles by separating object, components, and services into tiers with well-defined boundaries. Other benefits derived from this pattern include the ability to easily maintain, manage, and extend the system; more easily support multiple client devices; simplify testing procedures; and reduce code duplication.

The Client Tier
At this point, you can assume that the client tier handles only standard HTTP requests from a Web browser. Therefore, the FrontController class handles each request/response in a simple model-view-controller manner. However, the framework will eventually be modified to support a push-styled, event-driven model, which will make the framework more responsive and dynamic.

The FrontController class is defined as follows:

public class FrontController extends HttpServlet { public void init(ServletConfig servletConfig) throws ServletException { super.init(servletConfig); } protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { doGet(req, res); } protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { try { Model model = RequestProcessor.getInstance(). processRequest(req); // view type should be matched to request // type using config file String formatted = XSLViewFactory.getView(View.DEFAULT_VIEW). format(model.toXML()); PrintWriter out = res.getWriter(); out.println(formatted); out.flush(); out.close(); } catch (RequestException e) { PrintWriter out = res.getWriter(); out.println( "<H2>Error: " + e.toString() + "</H2>"); out.flush(); out.close(); } } }

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

Jeff Hanson has more than 18 years of experience in the software industry. He has worked as senior engineer for the Windows OpenDoc port and as lead architect for the Route 66 framework at Novell. He is currently Chief Architect for eReinsure, which specializes in providing frameworks and platforms for J2EE-based reinsurance systems. Jeff has also authored numerous articles and books.
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



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