PRADO Component Framework for PHP 5
  • Home
  • About
  • Testimonials
  • Demos
  • Download
  • Documentation
  • Forum
  • Development
  • Tutorials
  • Class Docs
  • API Manual
  • Wiki

Packages

  • None
  • System
    • Caching
    • Collections
    • Data
      • ActiveRecord
        • Relations
        • Scaffold
          • InputBuilder
      • Commom
        • Sqlite
      • Common
        • Mssql
        • Mysql
        • Oracle
        • Pgsql
        • Sqlite
      • DataGateway
      • SqlMap
        • Configuration
        • Statements
    • Exceptions
    • I18N
    • IO
    • Security
    • Util
    • Web
      • Javascripts
      • Services
      • UI
        • ActiveControls
        • WebControls
    • Xml
  • Wsat
    • pages
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo

Class TRpcService

TRpcService class

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 TModule that must subclass TRpcServer: its role is to be an intermediate, moving data between the service and the provider. The base 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 TModule that must subclass TRpcProtocol: its role is to implement the protocol that exposes the rpc api. Prado already implements two protocols: TXmlRpcProtocol for Xml-Rpc request and TJsonRpcProtocol for JSON-Rpc requests.

A provider is a TModule that must subclass 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 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:

<service id="rpc" class="System.Web.Services.TRpcService">
         <rpcapi id="customers" class="Application.Api.CustomersApi" />
  <modules>
    <!--  register any module needed by the service here -->
  </modules>
</service>

An api can be registered adding a proper <rpcapi ..> 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.

TComponent
Extended by TApplicationComponent
Extended by TService implements IService
Extended by TRpcService
Package: System\Web\Services
Copyright: 2010 Bigpoint GmbH
License: http://www.pradosoft.com/license/
Author: Robin J. Rogge <rrogge@bigpoint.net>
Version: $Id$
Since: 3.2
Located at Web/Services/TRpcService.php
Methods summary
public
# createApiProvider( TRpcProtocol $protocolHandler, string $providerId )

Creates the API provider instance for the current request

Creates the API provider instance for the current request

Parameters

$protocolHandler
TRpcProtocol
$protocolHandler instance
$providerId
string
$providerId
public
# init( TXmlElement $config )

Initializes the service

Initializes the service

Parameters

$config
TXmlElement
$config containing the module configuration

Overrides

TService::init()
public
# loadConfig( TXmlElement $xml )

Loads the service configuration

Loads the service configuration

Parameters

$xml
TXmlElement
$xml configuration
public
# run( )

Runs the service

Runs the service

Overrides

TService::run()
Methods inherited from TService
getEnabled(), getID(), setEnabled(), setID()
Methods inherited from TApplicationComponent
getApplication(), getRequest(), getResponse(), getService(), getSession(), getUser(), publishAsset(), publishFilePath()
Methods inherited from TComponent
__call(), __construct(), __destruct(), __get(), __isset(), __set(), __sleep(), __unset(), __wakeup(), addParsedObject(), asa(), attachBehavior(), attachBehaviors(), attachClassBehavior(), attachEventHandler(), canGetProperty(), canSetProperty(), clearBehaviors(), createdOnTemplate(), detachBehavior(), detachBehaviors(), detachClassBehavior(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), evaluateStatements(), fxAttachClassBehavior(), fxDetachClassBehavior(), getAutoGlobalListen(), getBehaviorsEnabled(), getClassHierarchy(), getEventHandlers(), getListeningToGlobalEvents(), getSubProperty(), hasEvent(), hasEventHandler(), hasProperty(), isa(), listen(), raiseEvent(), setSubProperty(), unlisten()
Constants summary
string BASE_API_PROVIDER 'TRpcApiProvider'
#

const string base api provider class which every API must extend

const string base api provider class which every API must extend

string BASE_RPC_SERVER 'TRpcServer'
#

const string base RPC server implementation

const string base RPC server implementation

Constants inherited from TComponent
GLOBAL_RAISE_EVENT_LISTENER
Properties summary
protected array $protocolHandlers array( 'application/json' => 'TJsonRpcProtocol', 'text/xml' => 'TXmlRpcProtocol' )
#

containing mimetype to protocol handler mappings

containing mimetype to protocol handler mappings

protected array $apiProviders array()
#

containing API provider and their configured properties

containing API provider and their configured properties

Terms of Service | Contact Us
PRADO v3.2.4 API Manual API documentation generated by ApiGen 2.8.0
Copyright © 2006-2014 by the PRADO Group.
Powered by PRADO