#1 2011-03-22 03:33:48

thunya
Member
Registered: 2011-03-14
Posts: 6

JSON RESTful Services, How to implement server method with obj param

I plan to implement server service that accept new object as parameter and process in server memory.

The formation is...
-Client call server function that accept some object as parameter [AFunction(obj: TSampleRecord)]
-Server decode json object to TSampleRecord
-Server process something with object(TSampleRecord) then save object to database and return result

Could you show some example code to guidance me?

thanks smile

Offline

#2 2012-01-23 10:25:54

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

Re: JSON RESTful Services, How to implement server method with obj param

With the default SOA implementation, you may use ObjectToJSON() and JSONToObject() functions, and send your object content as RawUTF8 to the server.

The upcoming interface-based service implementation will let you do this directly in the function parameter.

Offline

#3 2012-02-07 07:47:59

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

Re: JSON RESTful Services, How to implement server method with obj param

See also http://synopse.info/forum/viewtopic.php?pid=3468#p3468 about Server side implementation methods signature change.

Offline

#4 2012-02-08 00:52:53

Tom Duncan
Member
Registered: 2012-02-07
Posts: 49

Re: JSON RESTful Services, How to implement server method with obj param

Any ideas whena demo using json will be available.
I need to impliment a client/server application with sqlite.
would json act as a passthrough from the application to the server.

Tom

Offline

#5 2012-02-08 00:57:33

Tom Duncan
Member
Registered: 2012-02-07
Posts: 49

Re: JSON RESTful Services, How to implement server method with obj param

Also.
I am also writing this application for the android as well.
It uses json to get info from my server.
Could this also act as a json server for the android part of the program?

Tom

Offline

#6 2012-02-08 06:52:24

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

Re: JSON RESTful Services, How to implement server method with obj param

The JSON format is standard.
You can consume it with JavaScript, or any JSON parser without any problem.
So it will work without any problem with Android.

Offline

Board footer

Powered by FluxBB