company logo

OHTTP Mapping Tool (HTTPMapper)

ODABA provides a HTTP mapping tool in order to simplify the specification of requests. The mapping tool allows defining any number of queries. Query definitions are stored in the resource database for the application.

Query definitions support simple (one instance) queries, but also complex hierarchical queries. A set of queries may contain data retrieval, update, create or delete queries. In contrast to direct POST requests, queries allow single instance updated and creations, only.

When defining queries, a request type has to be set. Usually, different request types are used for following actions:

  • retrieve data completely: GET
  • retrieve selected fields: OSI
  • Update instance data: PATCH
  • Create new instance: PUT
  • Delete an instance: DELETE

Usually, POST is not used as query type.

Each mapping (query) is assigned to a class, which defines a complex data type in the application database. Class name and query (mapping) name must be unique, i.e. names for mappings belonging to the same class must differ. Except GET and DELETE queries, queries require a field list, which may be hierarchically structured. The field list defines a set of target names (field names) and data sources. For simple cases, data sources are simple attribute names of the datatype (class) defined for the mapping. Data sources may be defined, however, also as access path (e.g. employee(0).company(0).name in order to get the company name where the person is employed.

When the data source for a field is referring to a property with complex data type (referenced instance, embedded instance) or a collection, a subordinated field list may be defined, which refers to data source properties of the complex data type for the referenced instance(s).

The HTTPMapper is called with an .ini or configuration file. Supposed, that ODABA has been installed in an odaba directory, it might be called as follows:

The ini-file provides database locations for system databases. The applications resource database (DATDB) is passed in this example as parameter, but could also be defined in the ini-file.

In order to run tests, the HTTP Server and port have to be defined, too, in the HTTP section..

// ini-file ODE.INI for ODE tools

[SYSTEM]

DICTIONARY=odaba/ode.sys

[ode]

SYSDB=odaba/ode.sys

RESDB=odaba/ode.dev

;DATDB=Poject database passed as parameter

NET=YES

SYSAPPL=YES

ONLINE_VERSION=YES

PROJECT_DLL=Designer

CTXI_DLL=AdkCtxi

[HTTP]

Server=localhost

Port=2000