#1 2015-04-08 08:03:17

yankee
Member
Registered: 2015-04-08
Posts: 7

HTTP JSON Client for a non-mORMot server

Hi,
I'm trying to get the best from this fantastic mORMot framework but I'm not sure if/how I can push the envelope for my particular case:

I have to modify an existing Delphi7 Client/Server application that currently use ODAC components to connect to an Oracle DB server.
ALL the client DB stuff is made with Stored procedures, so NO CRUD, no direct SQL and just read-only responses.
My company chose to introduce a three-tier architecture and already developed a middleware that exposes the stored procedures as HTTP JSON requests/responses, just like mORMot.
But it's not a mORMot server.

Is there a way to use mORMot, other than the JSON parser, to obtain an efficient and easily scrollable sort of dataset (READ-ONLY)?

I see 3 points, here:
1) The HTTP client: I think I cannot unleash the power of TSQLRest classes because there is no such classes on the other side. No matter, I already implemented a multithread HTTPClient with Indy components;
2) The JSON parsing: I think I can use mORMot JSON parser here;
3) The uni-directional mapping of JSON content to Delphi data Structures;

I feel 2) and 3) can be combined in a powerful way, but I couldn't find that way yet. Or not?

Am I missing something?

Thank you in advance.

Offline

#2 2015-04-08 11:55:09

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,667
Website

Re: HTTP JSON Client for a non-mORMot server

I guess you are on the right track, here.

You may consider using a method-based service, or an interface-based service.
The dataset content could be published as JSON, using a RawJSON kind of parameter.
To create the JSON content, you may use directly our SynDBOracle.pas unit, which is very optimized, and should be able to work with stored procedures.

Offline

#3 2015-04-08 13:51:07

yankee
Member
Registered: 2015-04-08
Posts: 7

Re: HTTP JSON Client for a non-mORMot server

Thank you AB,

maybe I was not very clear. The Server part has already been developed, and exposes its services via HTTP.
It handles DB connection and stored procedures on its own.
So I can make an HTTP request with the right parameters and have a JSON response containing data.

My problem is how to implement the CLIENT side, in Delphi:
- Getting the response JSON stream (OK, with Indy HTTP client)
- Parsing the JSON into a...? TSQLTableJSON? ...or what else? I'd like to map to a TSQLRecord or something well defined at compile time, if possible.

Offline

#4 2015-04-09 08:58:18

edwinsn
Member
Registered: 2010-07-02
Posts: 1,218

Re: HTTP JSON Client for a non-mORMot server

Hi Ab,

Can the REST client in mORMot to be used (or extended in the future) like this github project,  Delphi REST Client API, to consume standard REST serivces, such as Goolge API? Thanks.


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

Board footer

Powered by FluxBB