PHP Class Prado\Web\Services\TRpcProtocol

TRpcProtocol is the base class used to implement a protocol in a {@link TRpcService}. Prado already implements two protocols: {@link TXmlRpcProtocol} for Xml-Rpc request and {@link TJsonRpcProtocol} for JSON-Rpc requests.
Since: 3.2
Author: Robin J. Rogge ([email protected])
Mostrar archivo Open project: pradosoft/prado Class Usage Examples

Protected Properties

Property Type Description
$rpcMethods containing the mapping from RPC method names to the actual handlers

Public Methods

Method Description
addMethod ( string $methodName, array $handlerDetails ) Registers a new RPC method and handler details
callApiMethod ( string $methodName, array $parameters ) : mixed Calls the callback handler for the given method
callMethod ( $requestPayload ) : processed
createErrorResponse ( TRpcException $exception ) : a
createResponseHeaders ( $response )
decode ( $data ) : mixed Decodes the request payload
encode ( $data ) : string Encodes the response

Method Details

addMethod() public method

Registers a new RPC method and handler details
public addMethod ( string $methodName, array $handlerDetails )
$methodName string
$handlerDetails array containing the callback handler

callApiMethod() public method

Calls the callback handler for the given method
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() abstract public method

abstract public callMethod ( $requestPayload ) : processed
return processed response

createErrorResponse() abstract public method

abstract public createErrorResponse ( TRpcException $exception ) : a
$exception TRpcException
return a response representing the error

createResponseHeaders() abstract public method

abstract public createResponseHeaders ( $response )

decode() abstract public method

Decodes the request payload
abstract public decode ( $data ) : mixed
return mixed decoded request

encode() abstract public method

Encodes the response
abstract public encode ( $data ) : string
return string encoded response

Property Details

$rpcMethods protected_oe property

containing the mapping from RPC method names to the actual handlers
protected $rpcMethods