PHP Класс Prado\Web\Services\TRpcService

The TRpcService class is a generic class that can be extended and used to implement rpc services using different servers and protocols. A server is a {@link TModule} that must subclass {@link TRpcServer}: its role is to be an intermediate, moving data between the service and the provider. The base {@link TRpcServer} class should suit the most common needs, but can be sublassed for logging and debugging purposes, or to filter and modify the request/response on the fly. A protocol is a {@link TModule} that must subclass {@link TRpcProtocol}: its role is to implement the protocol that exposes the rpc api. Prado already implements two protocols: {@link TXmlRpcProtocol} for Xml-Rpc request and {@link TJsonRpcProtocol} for JSON-Rpc requests. A provider is a {@link TModule} that must subclass {@link TRpcApiProvider}: its role is to implement the methods that are available through the api. Each defined api must be a sublass of the abstract class {@link TRpcApiProvider} and implement its methods. The flow of requests and reponses is the following: Request <-> TRpcService <-> TRpcServer <-> TRpcProtocol <-> TRpcApiProvider <-> Response To define an rpc service, add the proper application configuration: An api can be registered adding a proper definition inside the service configuration. Each api definition must contain an id property and a class name expressed in namespace format. When the service receives a request for that api, the specified class will be instanciated in order to satisfy the request.
С версии: 3.2
Автор: Robin J. Rogge ([email protected])
Наследование: extends Prado\TService
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$apiProviders containing API provider and their configured properties
$protocolHandlers containing mimetype to protocol handler mappings

Открытые методы

Метод Описание
createApiProvider ( TRpcProtocol $protocolHandler, string $providerId ) Creates the API provider instance for the current request
init ( TXmlElement $config ) Initializes the service
loadConfig ( TXmlElement $xml ) Loads the service configuration
run ( ) Runs the service

Описание методов

createApiProvider() публичный Метод

Creates the API provider instance for the current request
public createApiProvider ( TRpcProtocol $protocolHandler, string $providerId )
$protocolHandler TRpcProtocol instance
$providerId string

init() публичный Метод

Initializes the service
public init ( TXmlElement $config )
$config Prado\Xml\TXmlElement containing the module configuration

loadConfig() публичный Метод

Loads the service configuration
public loadConfig ( TXmlElement $xml )
$xml Prado\Xml\TXmlElement configuration

run() публичный Метод

Runs the service
public run ( )

Описание свойств

$apiProviders защищенное свойство

containing API provider and their configured properties
protected $apiProviders

$protocolHandlers защищенное свойство

containing mimetype to protocol handler mappings
protected $protocolHandlers