480 IBM WebSphere Host Publisher Version 3.5
Figure 16-25 Sample application using RIO proxy asynchronously (3 of 3): main method
16.6.4 Java sample program
A Java sample program is generated by the Host Publisher Studio when you
save the Integration Object with the RIO option. The Java program runs as an
applet (requires a Web browser) or as a stand-alone application. It uses the
Swing class for the GUI to get inputs and display the results. The program uses
the asynchronous callback scheme in the RIO proxy to invoke the execution of
the RIO request/response.
The name of the generated sample Java applet/application is
CustomApp<IOname>.java and you will find it in the following subdirectory:
d:\Hostpub\Studio\IntegrationObjects\RemoteIO\<IOname>\
where IOname is the Integration Object name.
Note: The compiled class ready for execution is also generated.
static public void main(String args[]) {
String HostName;
int i = 0;
for (i = 0; i < args.length; i++) {
System.err.println ("args["+i+"]= "+args[i]);
}
if (args.length == 0) {
System.err.println ("Usage: TestRio2 AccountNumber [HostName]");
System.exit (1);
}
if (args.length == 2)
HostName = args [1];
else
HostName = "127.0.0.1"; // default to same server
new TestRio2(HostName, args[0]);
}
}
interface HPubReqCompleteListener extends EventListener {
void hPubReqComplete(HPubReqCompleteEvent evt);
}
Chapter 16. Remote Integration Objects (RIO) 481
Figure 16-26 illustrates the Swing GUI when the generated sample program is
executed. It takes input values for the input properties and displays the output in
the bottom part of the window.
The Submit button is used to send the request and the Session for Chaining box
is used to set the session ID when Integration Object chaining is used. For details
about chaining, see 16.8, RIO chaining support on page 491.
Figure 16-26 Java applet and application using RIO proxy
In addition, the following generated files can also be used with this sample
program:
򐂰 AppLoader<IOname>.html. A sample HTML page to execute the sample
program as a Java applet.
򐂰 CompileCustomApp<IOname>.bat. A batch file you can use to compile the
sample program if needed.
򐂰 RunCustomApp<IOname>.bat. A batch file you can use to run the sample
program as a Java application.

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.