Skip to content
Home » Company » Sample applications and example code » VDF Ajax Web service

VDF Ajax Web service

The Visual DataFlex Ajax library is made up of a number of distinct elements:

It is the last of these – the VDF Ajax web service – that we are interested in here.

The VDF Ajax web service encapsulates a great deal of complexity, to a large degree necessitated by its need to be deployed on top of databases unknown to it when it was written.

The service exposes eight operations:

  • MetaDataWO: Returns some general service setting and information on the Data Dictionary objects used by the requested web object (WO)
  • MetaDataFields: Returns data on the commonly used settings for the requested database fields
  • MetaDataProperties: Returns data on the less-common database field settings
  • MetaDataDescriptionValues: Returns the codes and descriptions for a database field’s validation table (if one exists)
  • Request: This is the “Swiss Army Knife” workhorse method of the service, through which all normal database “CRUD” actions – Finding, Saving and Deleting records – are performed. It is inordinately complex, as a glance at its definition will quickly reveal!
  • ValidateField: Performs validation on a value for a database field
  • RemoteMethodInvocation: If the Request operation is the “Swiss Army Knife” of the service, RMI is its silly putty. It can access any published method of the service, taking up to 16 parameters, but only returning a single string value (plus an array of errors if any occurred)
  • LoadTreeNodes: This is a special method which is defined, but not implemented, in the Ajax framework itself, so must be supplied by the programmer where required. It is designed to support the framework’s Ajax Tree-View component

In addition to these, the server-side ASP code makes an initial call to the service’s Session Manager object to create a new session when a user first loads a page from the application. The identifier (key) for this is passed to the browser as an HTTP “cookie” and is used in all browser requests to the service to identify the session.

The Ajax Order Entry sample also offers a user login mechanism, which in the case of the Ajax Order Entry sample is implemented through an application of the “RemoteMethodInvocation” operation which calls a function in the service’s Session Manager object.