JSON interface with Smart Mobile Studio

Hi,
I need somme help.
I’m trying to connect a Smart Mobile Studio client to a basic RO Server with JSONMessage.

But I’ve got this error message:
_Error : JSONMessage.read error: _
Result:Integer is missing.

Although Debug goes fine on the server, and I’m using the lastest RemObjectsSDK.js from today RO install.

Below the SMS code:

procedure TForm1.W3Button1Click(Sender: TObject);
begin
  var channel := TROHTTPClientChannel.Create('http://localhost:8823/json');
  var message := TROJSONMessage.Create();
  var serveur := TCheckService.Create(channel, message);
  serveur.Sum(8, 10,
    procedure (aResult: integer) begin
       W3Memo1.Add('Total = ' + IntToStr(aResult));
    end,
    procedure (aMessage: TROMessage; aError: JError) begin
       W3Memo1.Add(aError.name + ' : ' + aError.message);
    end
    );
end;

Forgot to say that I do have implemented the Add service, witch is void by default.

can you show generated JSON, pls?
you can also send it to support@ if it contains private content

Headers:

Request URL:http://localhost:8823/json?1513250315143
Request Method:POST
Status Code:200 OK
Remote Address:127.0.0.1:8823
Referrer Policy:no-referrer-when-downgrade
Response Headers
view source
Accept-Encoding:gzip, identity
Access-Control-Allow-Origin:*
Connection:close
Content-Length:29
Content-Type:application/json; charset=utf-8
Date:Thu, 14 Dec 2017 11:18:35 GMT
Server:Remoting SDK
Request Headers
view source
Accept:/
Accept-Encoding:gzip, deflate, br
Accept-Language:fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7
Connection:keep-alive
Content-Length:99
Content-type:application/x-www-form-urlencoded
Host:localhost:8823
Origin:http://192.168.1.18:8011
Referer:http://192.168.1.18:8011/index.html
User-Agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36
Query String Parameters
view source
view URL encoded
1513250315143:
Form Data
view source
view URL encoded
{“id”:“{045e9088-afbd-4323-b866-c9169cd779bc}”,“method”:“CheckService.Sum”,“params”:{“A”:8,“B”:10}}:

Response:

{“version”:“1.1”,“result”:18}

try to set TROJSONMessage.WrapResult to True

1 Like

Also have to mention that starting next Beta it will be possible to configure JSONMessage so it could accept data sent with and without WrapResult flag set on the server side.

This means that server response like

{“version”:“1.1”,“result”:18}

wll be acceptable as well.

1 Like