JsonRPCError from post access

Hi

I have a RO service (delphi server) with ClassFactory like:
TROClassFactory.Create(‘MyService’, Create_MyService, TRORTTIInvoker);

I’m access my service by http post (use Postman for tests). When I call function that contains native type return, thats ok, but if my function service contains TJSONObject or person object return (TMyObject for exemple), the following error is returned:
{“version”: “1.1”,
“error”: {
“name”: “JsonRPCError”,
“code”: “1”,
“message”: “Type “tkClass” not supported”},
“result”: null}.

I can not have these types of results in my service?
Thanks.

You can use only these types:

  • Integer
  • DateTime
  • Double
  • Currency
  • WideString
  • AnsiString
  • Int64
  • Boolean
  • Variant
  • Binary (TMemoryStream descendant)
  • Xml (IXMLNode)
  • Guid
  • Decimal
  • Utf8String
  • XsDateTime (this is TROComplexType descendant)
  • TROComplexType descendants
  • TROArray descendants
  • enumerations.

I can recommend to launch ServiceBuilder and try to design your service. as a result, you will know what types you can use.

So there is no way to get JSON value from my service automatically, unless I convert to UTF8String before traveling?

you can pass json value as binary/string and manually parse it with JSON_ParseStream from uROJSONParser.pas

function JSON_ParseStream(AData: TStream; aUTF8Stream:Boolean = True):TROJSONValue;

Ok, thanks EvgenyK.