Chapter 18. XML Legacy Gateway 581
18.6 XML Legacy Gateway JavaBean interface
The XML Legacy Gateway provides two components that communicate with a
host application:
򐂰 The xmlLegacyGateway servlet
򐂰 The xmlAppData JavaBean
Note: In addition, the HostConnection class is provided by Host Publisher.
18.6.1 The xmlLegacyGateway servlet
The xmlLegacyGateway servlet transforms XML data into HTML format. This
servlet enables viewing of a host window in a Web browser. A user can interact
with the host window in the browser by typing in the fields in the window or by
using the function keys, which are displayed as buttons in the browser. Because
the servlet interacts with the host application, most of the data processing takes
place at the server. This enables browser access to host applications from a thin
client.
The servlet uses Extensible Stylesheet Language (XSL) processing to transform
XML data to HTML format. This is a powerful example of how to transform the
host window into XML data and, through the use of a stylesheet, present it to the
end user in a different format. By replacing or modifying this servlet, the supplied
stylesheet, or both, and by using an XSL processor such as the one included in
WebSphere Application Server, the application programmer can easily render
host data onto a variety of devices using a single servlet with multiple style
sheets. The source code for the servlet is included with the Host Publisher
product.
Refer to Figure 18-2 on page 572 to see how the xmlLegacyGateway servlet
relates to the other components of the XML Legacy Gateway.
The xmlLegacyGateway servlet:
1. Is instantiated with form parameters that describe the desired host session.
These parameters describe the Telnet name of the host, the terminal format
(3270 or 5250) of the session, and so on.
2. Initiates a host session using Host Publisher and IBM Host On-Demand Java
objects and properties.
3. Instantiates the xmlAppData JavaBean and makes the JavaBean a listener for
Host On-Demand events.
4. Retrieves, after a programmed delay, the current state of the host window as
XML data from the xmlAppData JavaBean.
582 IBM WebSphere Host Publisher Version 3.5
5. Formats the XML data as HTML output using an XSL stylesheet and an XSL
processor. This output is returned to the browser.
The HTML output returned to the browser shows how the window displays on a
traditional terminal. The user can input data directly onto the HTML host window.
The user can move the cursor to the input fields using the mouse or the Tab key.
The traditional terminal function keys are presented to the user as buttons in the
browser window. The user can select the buttons by using the mouse or using
the Tab key and pressing the Enter key on the keyboard.
Two additional buttons are presented on the user's browser page: Refresh and
Disconnect. The Refresh button updates the browser's host window to the
current state of the host session, ignoring possible input. The Disconnect button
terminates the current host session. Disconnection enables an efficient use of
Host Publisher resources. The user should disconnect the host session when
interaction with the host application is no longer needed.
While the servlet is a useful application, it is an example of how to interact with
Host Publisher to encapsulate host data in XML format. The servlet could be
changed to interact with the host application using XML processing techniques,
in an automated fashion, presenting the user with a specific subset of information
obtained from the host.
The data can also be rendered in different formats by using a different XSL
stylesheet when processing the data. The servlet can be changed to render the
data in a format that matches the output preference of the user or the user's
access device. The servlet can do this at run time by specifying the XSL
stylesheet used for this particular instance of the servlet.
To facilitate the writing of Host Publisher XML Legacy Gateway servlets, the
source code for the xmlLegacyGateway servlet is included with Host Publisher.
HTML documentation is also included. The source code and all documentation
can be accessed starting with the following file:
install_dir\SDK\XLGW\Introduction.html
where install_dir is the directory in which Host Publisher is installed.
In summary, the xmlLegacyGateway servlet provides a detailed sample of how to
interface with host applications using the xmlAppData Bean. It implements basic
TN3270 and TN5250 HTML-to-Host Emulation by using about 90% of the XML
gateway application interface.
Note: The sample XML Legacy Gateway Administration is located in the
<HostPub>\SDK\XLGW\Servlet\xmlLegacyGatewayServletSample.

Get A Comprehensive Guide to IBM WebSphere Host Publisher Version 3.5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.