You are not logged in.
In mormot, when the interface-based method returns a value via TrestServerUriContext, can it be wrapped in json format like :
{
code:errcode,
msg:'errmsg',
data/(result):{... } or [... ]
},
Most Rest servers currently communicate with js clients in a format similar to this
Online
Thank you for your reply.
This is done using method-based services, which do not take advantage of the convenience of interface-based services. Or, in an interface-based service, how do you get the output parameters to be written in such a format?
Online
At your prompt, I read the source code TrestServerUriContext in detail, and it is indeed possible to override ServiceResultStart and ServiceResultEnd requirements through inherited classes.
Thanks again for the tip.
Online
My English is poor, most of these contents are written with the help of translation software, some descriptions may not be accurate, which will cause trouble to you.
Online
By customizing the Routing class, I changed the format of the returned data to meet my requirements in the web client, but if the same interface needs to work in the pascal client, it should not be recognized correctly. Should there also be a corresponding method in the TRestClientRouting's inheritance class that can customize the data returned by parsing?
Online
I have added a TRestClientRouting.ClientSideInvoked virtual class method
to customize the returned JSON on client side:
https://github.com/synopse/mORMot2/commit/2eff980f
Offline
Thank you for your great work!
I read the source code and in the new method you added: in the InternalInvoke function of the mormot.soa.client unit, when the clientSideInvoked method is invoked in the DoClientCall method, should the parameter "send" be "resp"?
Online
Of course, you are right.
Please try with
https://github.com/synopse/mORMot2/commit/40b4f571
Offline