PHP Class Prado\Web\Services\TJsonRpcProtocol

TJsonRpcProtocol is a class that implements JSON-Rpc protocol in {@link TRpcService}. Both version 1.0 and 2.0 of the specification are implemented, and the server will try to answer using the same version of the protocol used by the requesting client.
Since: 3.2
Author: Robin J. Rogge ([email protected])
Author: Fabio Bas ([email protected])
Inheritance: extends TRpcProtocol
Datei anzeigen Open project: pradosoft/prado

Protected Properties

Property Type Description
$_id
$_specificationVersion

Public Methods

Method Description
callApiMethod ( string $methodName, array $parameters ) : mixed Calls the callback handler for the given method Overrides parent implementation to correctly handle error codes
callMethod ( string $requestPayload ) : string Handles the RPC request
createErrorResponse ( TRpcException $exception ) : string Turns the given exception into an JSON RPC fault
createResponseHeaders ( THttpResponse $response ) Sets the correct response headers
decode ( string $data ) : array Decodes JSON encoded data into PHP data
encode ( $data ) : string Encodes PHP data into JSON data

Private Methods

Method Description
checkJsonError ( )

Method Details

callApiMethod() public method

Calls the callback handler for the given method Overrides parent implementation to correctly handle error codes
public callApiMethod ( string $methodName, array $parameters ) : mixed
$methodName string of the RPC
$parameters array for the callback handler as provided by the client
return mixed whatever the callback handler returns

callMethod() public method

Handles the RPC request
public callMethod ( string $requestPayload ) : string
$requestPayload string
return string JSON RPC response

createErrorResponse() public method

Turns the given exception into an JSON RPC fault
public createErrorResponse ( TRpcException $exception ) : string
$exception TRpcException
return string JSON RPC fault

createResponseHeaders() public method

Sets the correct response headers
public createResponseHeaders ( THttpResponse $response )
$response THttpResponse

decode() public method

Decodes JSON encoded data into PHP data
public decode ( string $data ) : array
$data string in JSON format
return array PHP data

encode() public method

Encodes PHP data into JSON data
public encode ( $data ) : string
return string JSON encoded PHP data

Property Details

$_id protected_oe property

protected $_id

$_specificationVersion protected_oe property

protected $_specificationVersion