You are not logged in.
Pages: 1
Hi everyone,
I want to create a client that can consume webservices other than those created with the mORMot framwework. These
webservices communicates through JSON.
Is this possible and what steps do I need to take?
Thanks,
Wai
fpcdeluxe, FPC 3.2 / Lazarus 2.0, mORMot on Windows 10 ...
Offline
You have all needed bricks at hand, i.e. HTTP requests and JSON parsing.
But the JSON parsing is optimized for the mORMot layout.
http://blog.synopse.info/post/2011/06/0 … ON-parsing
In short, this is a SAX in-place parser, optimized for the mORMot requests.
It won't create a DOM tree, as other parsers do.
Do you need a DOM access, i.e. direct access to any node.
We may easily add it over the SAX parser.
I suppose we may be able to make something very fast, not based of one class instance per node, but with record and arrays structures - with the same DOM syntax on your side.
Offline
To connect a HTTP client I need to pass a TSQLModel as one of the arguments:
client := TSQLHTTPClient.create(ServerAddres, ServerPort, Model)
Can I simply pass nil as Model?
As for JSON, I will be using the JSONtoDataset routines.
fpcdeluxe, FPC 3.2 / Lazarus 2.0, mORMot on Windows 10 ...
Offline
The TSQLRest children (like TSQLHTTPClient) are ORM and MVC oriented.
So it NEEDS a TSQLModel, by design.
It won't help you for client side, since it has its own REST routing scheme, based on the ORM model.
See http://synopse.info/fossil/finfo?name=S … Server.dpr
and http://synopse.info/fossil/finfo?name=S … Client.dpr
for some code by-passing the mORMot ORM kernel and REST routing.
Offline
Merci beaucoup for the tip. This one has put me on route again .
fpcdeluxe, FPC 3.2 / Lazarus 2.0, mORMot on Windows 10 ...
Offline
Pages: 1