Flex, Java/JavaFX, Silverlight, AJAX & RIA Frameworks

RIA Developer's Journal

Subscribe to RIA Developer's Journal: eMailAlertsEmail Alerts newslettersWeekly Newsletters
Get RIA Developer's Journal: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn


RIA & Ajax Authors: Javier Paniza, Pat Romanski, RealWire News Distribution

Related Topics: RIA Developer's Journal, XML Magazine, SOA & WOA Magazine

RIA & Ajax: Article

Prognos with DataWindow.NET 2.0 and PowerBuilder 11 Web Services

Calculate Your Scholarship Online

Prognos is an application used over the Internet to determine if it makes sense to apply for a scholarship. It's part of a program package used in a couple of cantons (the equivalent of a state in the U.S.) in Switzerland to manage applications for a scholarship.

The current version runs with DataWindow.NET 2.0 and uses PowerBuilder 11 Web Services. To keep the installation slim it uses no database; instead the data is stored in DataWindows or XML files. Prognos makes use of AJAX techniques and accesses .NET classes from PowerBuilder for XML handling. Since it's used in Switzerland (which has four official languages: German, French, Italian, and Romansh) it's multilingual.

Initial Version
We developed the first version of Prognos with DataWindow.NET 1.5 using ASP.NET with C#. Our partner company implemented the calculation for a possible scholarship in a PowerBuilder application. The algorithm was tested by the customer in this PowerBuilder application. After its approval, we had to convert the PowerBuilder calculation to C#, which was quite easy but prone to error due to formatting, data types, and so on.

Configuration
When DataWindow.NET 2.0 was available and PowerBuilder 11 went into beta, we decided to redesign the application, make use of the new PowerBuilder 11 features, and switch to ASP.NET 2.0.

The application consists of two parts (see Figure 1). The visual part is a standard ASP.NET 2.0 application using DataWindow.NET 2.0. The other part of the application consists of PowerBuilder 11 Web Services. The visual part talks to the Web Services either directly from the browser using AJAX or from the back-end for calculations.

You might ask why we didn't use a PowerBuilder 11 WebForm for the front-end. There are several considerations:
• We already had a running application with DataWindow.NET and quite a bit of JavaScript for handling logic and browser issues in the front-end that we could use.
• We have to support a lot of different browsers on Windows, Mac, and Linux, which includes quite some fine-tuning in the front-end. This is not supported in PowerBuilder 11.
• As soon as you include PowerScript in a client-side event its execution will cause a post back to the server.

Another point is the use of a Web Service instead of creating a .NET assembly and using the assembly in the application. Our decision was based on the following issues:
• With this design it's possible to make asynchronous calls from the browser to the back-end without writing additional code in C#.
• The Web Service can be consumed by other applications as well. The logic we used to calculate the possible scholarship was copied from another application upon approval. Instead of the copy we could write a Web Service upfront and have the algorithm approved by the customer through the Web Service
• Service Oriented Architecture (SOA) allowed the partitioning of the application and due to loose coupling you could change the calculation without touching the front-end.

Short Intro to AJAX
As you probably know PowerBuilder quite well and have some idea about DataWindow.NET I'll just give a short introduction to AJAX.

AJAX means Asynchronous JavaScript and XML. The idea behind it is that a browser can make calls to the server in the background without needing to leave or refresh the page. The technique has been around for quite some years but only got its catchy name in 2005.

Nowadays it makes use of the XMLHTTPRequest that's available natively in most browsers. However there are other techniques around like using an IFRAME that work in older browsers as well.

Making use of this technique creates Web-based applications that behave like traditional client/server apps. When driving it to the edge, you can create a Web application with one single page like a MDI Frame that never gets refreshed and where all the processing and work is done in this one page. I saw different frameworks to create this type of application at the AJAXWorld Conference East (a Sys-con conference) in New York this spring. This behavior is certainly a trend for upcoming Web applications.

Currently there are about 200 AJAX frameworks around. They range from simple JavaScript libraries to full-blown back-end/front-end solutions. As DataWindow.NET generates a lot of JavaScript already and we didn't need catchy screen effects (which wouldn't be too easy with DataWindow.NET) and a lot of other features we decided to write the asynchronous calls to the back-end ourselves.

The Front-End
Prognos consists of an intro page with some contact and use information. That's followed by a couple of pages for entering data and a final page where the possible scholarships and some additional information are shown. The whole look of the application can be configured quite easily. The data entry pages and the result pages are created with embedded DataWindows.

For many labels there's a help button available. By clicking on it you get context-specific help for this label. The help information is retrieved through a Web Service and displayed in a dynamically created DIV tag in the current browser window (see Figure 2). Of course we implemented a fallback too where an additional browser window opens showing the help (just in case there's no way to make an asynchronous call).

We also made use of AJAX in complex validations. Not for empty fields or simple values but for checking the possible ways the two parents of the applicant can live together and how they can take care of their child. As there are around 70 possibilities and we had the logic already implemented in the client/server management application in PowerBuilder, we decided to offer it as Web Service.

We also overwrote the default Alert function in JavaScript, which shows a gray pop-up window, with a nice error message displayed in a DIV tag like the help information.

In the ASP.NET part, when the page executes on the server, the text of the labels depends on the language the user has chosen. The translation is based on the name of the label and is done by the DataWindow.NET method Modify().

More Stories By Arthur Hefti

Arthur Hefti is CEO of CATsoft Development GmbH in Zurich. He has been working with PowerBuilder since version 3 and taught dozens of PowerBuilder training classes. He and his team create custom-made client/server and Web applications using XML, Web Services, and encryption.

Comments (1) View Comments

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


Most Recent Comments
Alan 06/21/07 09:59:26 AM EDT

I think this is a very trivial application and it should not be talked about in pbdj even if it is for the sake of showing a technical argument.

Seems more like an addvertisemt !! The whole app would take no longer than 3 days of work !! Writting the word Switzerland does not make it a high end contrinution :-)