One of the client platforms for Data Abstract that has so far received little attention are JavaScript based web clients.

This morning I wrote a simple JavaScript (dojo toolkit based) web application that talks to an expanded PCTrade Sample Server. It leverages the JsonMessage to talk to the server, using JavaScript code for the simple service generated with Service Builder. The Dojo Toolkit btw is a very nice toolkit for writing javascript web applications.

Click on the image to start the video:

Start the video


The Data Abstract Server sample contains a custom ExtendedHttpDispatcher implementation that serves the files in the javascript/ directory part of the sample, so acts like a regular web server when accessing, sending the files as-is, like a regular web server. The index.html file contains the JavaScript code, part of which is created with Service Builder, using the Tools/CodeGen/JavaScript menu on the Data Abstract Simple Data Service RODL.

Note that due to JavaScript security, the sample only works when accessing it from the same URL as the service itself.

The service provides 2 methods interesting for this web interface:

  • GetSchema: Returns the schema as an xml, used to populate the tree view on the left
  • SimpleGetData: GetData implementation that returns the data in an array of array of string with some Schema information.

The JavaScript application first asks for the schema, and uses XML DOM to find the names of all DataTables and their columns. When clicking a data table it changes the text area to the DA SQL select statment for that table. The “Execute Query” button calls the SimpleGetData service api, and when the callback for the response occurs, fills the grid with the returned data.