Datasnap.DSService.TDSJSONService

From RAD Studio API Documentation
Jump to: navigation, search

Error: Image is invalid or non-existent.

Delphi

TDSJSONService = class(TDSService)

C++

class PASCALIMPLEMENTATION TDSJSONService : public TDSService

Properties

Type Visibility Source Unit Parent
class public
Datasnap.DSService.pas
Datasnap.DSService.hpp
Datasnap.DSService Datasnap.DSService

Description

Implements the service for the JSON HTTP request.

JSON HTTP requests are POST HTTP requests with JSON content, such as:

{
  [
    "execute": {
      "MethodClass.MethodName": [
        inputParameter1,
        inputParameter2
      ]
    }
  ],
  // …
}

TDSJSONService raises an exception if it cannot parse the JSON content.

TDSJSONService generates a result JSON property called "result" for each method, which contains a list with the values of the output and return parameters of the method execution. For example:

{
  "result": [ parameterValue1, parameterValue2, /* …, */ returnValue],
  "result": [ parameterValue1, parameterValue2, /* …, */ returnValue],
  // …
}

If a method raises an exception, the response contains an "error" property for that method instead of a "result" property. The "error" property contains the error message as value. For example:

"error": "Error message."

See Also