#1 2017-06-14 06:50:24

dexter
Member
Registered: 2015-04-24
Posts: 53

Returning a JSON object as RawJSON from SOA

Hi,

I have a server function which returns a RawJSON string:

function Connect(const aUrl: RawUTF8): RawJSON;

Function result from server:
20170614 06363933 ret           uHTTPServer.TOdbcRestServer(7EF49BE0) {Result:{"SessionId":2,"ProductName":"","ProductVer":"","MajorVer":0,"MinorVer":0}}

On client side, when I call Connect I expect to receive as result value: {"SessionId":2,"ProductName":"","ProductVer":"","MajorVer":0,"MinorVer":0}
But it raises error in FakeCall: Unexpected parameter "SessionId".
Looks like it searches for a var/out parameter SessionId, which is obviously missing.

How can I return back a JSON string from a server function?

Offline

#2 2017-06-14 07:41:26

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

Re: Returning a JSON object as RawJSON from SOA

Please ensure you read the doc about response format.
https://synopse.info/files/html/Synopse … #TITLE_458
(and previous paragraphs)

As documented, SessionId is a hidden parameter, used for sicClientDriven mode.
In the server logs, you don't see it, but it is transmitted to the client side, to identify the session expected.

Both client and server side should use the very same routing settings.

Offline

#3 2017-06-14 10:46:46

dexter
Member
Registered: 2015-04-24
Posts: 53

Re: Returning a JSON object as RawJSON from SOA

I got it, thanks!

Offline

Board footer

Powered by FluxBB