Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

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

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.


advertisement
XMLHttpRequest Object Methods and Properties
The XMLHttpRequest has a set of methods and properties common to all supported environments (browsers). Table 1 shows the most frequently used XMLHttpRequest object methods. Table 1. The table lists frequently used XMLHttpRequest object methods.
Method Description
abort() Stops the current request
getAllResponseHeaders() Returns complete set of headers (labels and values) as a string
getResponseHeader("headerLabel") Returns the string value of a single header label
open("method", "URL"[, asyncFlag[, "userName"[, "password"]]]) Assigns destination URL, method, and other optional attributes of a pending request
send(content) Transmits the request, optionally with a POST string or DOM object data
setRequestHeader("label", "value") Assigns a label/value pair to the header to be sent with a request

The XMLHttpRequest object also shares a common set of properties across all supported environments. Table 2 shows the XMLHttpRequest object properties.

Table 2. The table shows a list of frequently used XMLHttpRequest object properties.

Property Description
onreadystatechange Event handler for an event that fires at every state change
readyState Status: 0 = uninitialized 1 = loading 2 = loaded 3 = interactive 4 = complete
responseText String version of data returned from server process
responseXML DOM-compatible document object of data returned from server process
status Numeric code returned by server, such as 404 for "Not Found" or 200 for "OK"
statusText String message accompanying the status code

At this point, you've seen how to refactor a mainframe application into deployable Web services using service-oriented techniques and a standard Java servlet framework. This article discussed how to access that framework using queries from a the now-ubiquitous browser-based XMLHttpRequest object to invoke the Web services and provide data from the mainframe 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.

 

 

Sitemap