Introduction
Smalltalk Exchange is a multi-tiered application that demonstrates how VisualAge Smalltalk applications can be integrated with systems constructed in other languages like Java. The application exploits the RMI and XML capabilities of VisualAge Smalltalk V5.5 to leverage business functionality from various sources.
The overall application is broken down into 4 separate features.
Browser client interface
The web browser interface is constructed using HTML and JSP files that were developed outside of the Smalltalk environment. The JSPs are used to present the dynamic model content generated by Smalltalk to the user.
Java servlets were developed as facades to the Smalltalk applications. Their sole purpose is to route requests from the WebSphere (or Tomcat) application server to Smalltalk. Java RMI (remote method invocation) was the technique used to communicate between Java and Smalltalk.
NOTE: The same user interface could have easily been constructed VisualAge Web Connection. However, we use servlets and Java Server Pages merely to demonstrate the interoperability between Smalltalk and Java and to demonstrate how Smalltalk can leverage other enterprise tools.
ULC (Ultra Light Client) interface
Smalltalk Exchange also ships with a user interface developed using the Ultra Light Client. ULC technology facilitates the development of rich user interfaces that have increased usability relative to a standard HTML page rendered with a web browser. Usage of ULC in the Smalltalk Exchange application demonstrates how various front-ends can be used to communicate with Smalltalk server applications. A ULC front end might be added to an application to provide custom behavior for a subset of users. For example, the Smalltalk Exchange application uses ULC to deliver a rich user interface that might be used by a stockbroker for managing his/her customers. Developers of ULC clients should be aware of the pros and cons of using this technology. Further, performance and scalability testing should be considered an integral part of the development cycle.
Smalltalk RMI server / XML requester
This portion of the application performs the following sequential operations:
This section of the Smalltalk Exchange is the controlling layer of the application. Requests are accepted via RMI and then ‘repackaged’ in XML and sent to their proper destination. Likewise, information sent back to this Smalltalk control layer is properly converted from XML to an RMI call. This call chain represents a typical example of how information is transformed throughout distributed systems in order to leverage specialized services.
Smalltalk Web Connection/XML server
An XML request handler is invoked via the WSI (Web Server Interface) of Web Connection. This server performs the following operations:
This portion of the application demonstrates usage of the XML parser, highlighting the object serialization framework.
Setting up the demo
This section discusses the steps required to configure the Smalltalk Exchange application.
Deploying HTML and Java components
Tomcat
The server automatically expands the contents of the 'vastock.war' file during startup. All required resources should be in place after the server has successfully started.
· Edit the file <tomcat root>\webapps\vastock\login.html and modify the 'value' attribute in the line below to contain the server where the Smalltalk RMI layer will execute.
<input type="hidden" name="registryloc" value="smalltalk-host">
WebSphere
Users of WebSphere 3.5.2 (3.5 with Fixpack-2) can use the supplied WebSphere tools to import the contents of the 'vastock.war' file into the WebSphere environment. This is accomplished using the WebSphere Administrator menu option 'Console->Tasks->Convert a War File'.
Otherwise, a new Web Application called 'vastock' should be created and the resources below should be added:
LoginServlet |
com.ibm.vast.stockdemo.LoginServlet |
LogoutServlet |
com.ibm.vast.stockdemo.LogoutServlet |
QueryServlet |
com.ibm.vast.stockdemo.QueryServlet |
TransactionServlet |
com.ibm.vast.stockdemo.TransactionServlet |
ErrorReporter |
com.ibm.servlet.engine.webapp.DefaultErrorReporter |
jsp11 |
org.apache.jasper.runtime.JspServlet |
file |
com.ibm.servlet.engine.webapp.SimpleFileServlet |
The contents of '.\java\vastock.war' must be unzipped, and all web resources (servlets, JSPs, HTML files, images) must be copied to the proper directories in the application server. The directory structure of the WAR file should be preserved when unzipping and copying files.
Loading VisualAge Smalltalk code
Below is a summary of the configuration maps defined for the Smalltalk Exchange application along with the prerequisite VisualAge features. Make sure prerequisite features are loaded prior to attempting to load the Smalltalk Exchange maps.
Map name |
Contents |
Prerequisites |
VaStockPortfolioBase |
contains model classes |
VA: XML support |
VaStockXMLFixes |
Fixes to VA: XML suppport feature. This map should only be loaded when running version 5.5. Subsequent VA releases already contain the fixes. |
VA: XML support |
VaStockPortfolioClient |
RMI mappings, XML requester code |
VaStockPortfolioBase ST: Server, SST |
VaStockPortfolioServer |
XML server |
VaStockPortfolioBase |
VaStockPortfolioULCClient |
ULC front end logic and interface |
VaStockPortfolioClient VA: ULC - Development.. |
Running the application
1. Start the 'Smalltalk Exchange' XML server. The server can run in the development image or via a packaged runtime image. A packaged runtime image is supplied as ..\image\vastock.icx.
2. Set the URL for the XML client ie) VaStockXmlRequester current urlString: 'http://myserver/servlet/com.ibm.abt.web.servlet.Router/VaStockRequestHandler'
3. Reset/Export required RMI mappings
4. Start the web server and the web application if necessary. Check the instructions for your web server for the steps required to activate the 'Smalltalk Exchange' Java servlets.
5. Invoke the Smalltalk Exchange by invoking the 'login.html' file from a browser. The URL will be similar to http://myserver/vastock/login.html
6. Enter a valid userid (valid ids are '000001'-'000004'). Enter any value for the password (how's that for security?), and press the 'Login' button. The application should be intuitive
See the file 'vastock.ws' for some useful code snippets.
Running the ULC client
The main view for the ULC portion of the stock demo is 'VaStockBrokerView'. Prior to trying this view, you must first install and start the ULC UI engine. After starting the 'Smalltalk Exchange' XML server (described above), test the 'VaStockBrokerView' from the VisualAge Organizer.
Obtaining "Live" stock quotes
By default, the stock quote server obtains quotes and charts from previously saved files (.\image\vastock.listings and .\image\vastock.charts). The following tickers are represented: ARBA,BBY,C,DELL,GTW,IBM,MSFT,SUNW,YHOO
If you would like the server to obtain a "live" quote from the network, you must start the XML server image using the '-live:true' command line option.
ie) vastock -live:true