Class TRpcClient

Description

TRpcClient class

Note: When using setIsNotification(true), *every* following request is also considered to be a notification until you use setIsNotification(false).

Usage:

First, you can use the factory:

 $_rpcClient = TRpcClient::create('xml', 'http://host/server');
 $_result = $_rpcClient->remoteMethodName($param, $otherParam);

or as oneliner:

 $_result = TRpcClient::create('json', 'http://host/server')->remoteMethod($param, ...);

Second, you can also use the specific implementation directly:

 $_rpcClient = new TXmlRpcClient('http://host/server');
 $_result = $_rpcClient->remoteMethod($param, ...);

or as oneliner:

 $_result = TXmlRpcClient('http://host/server')->hello();

Located in /Util/TRpcClient.php (line 49)

TComponent
   |
   --TApplicationComponent
      |
      --TRpcClient
Direct descendents
Class Description
TJsonRpcClient TJsonRpcClient class
TXmlRpcClient TXmlRpcClient class
Method Summary
static TRpcClient create ( $type,  $serverUrl, [ $isNotification = false])
TRpcClient __construct (string $serverUrl, [boolean $isNotification = false])
void createStreamContext (mixed $content, string $contentType)
boolean getIsNotification ()
string getServerUrl ()
void performRequest (string $serverUrl, array $payload, string $mimeType)
void setIsNotification (string $bool)
void setServerUrl (string $value)
Methods
static method create (line 80)

Creates an instance of the requested RPC client type

  • return: instance
  • throws: TApplicationException if an unsupported RPC client type was specified
  • access: public
static TRpcClient create ( $type,  $serverUrl, [ $isNotification = false])
  • $type
  • $serverUrl
  • $isNotification

Redefined in descendants as:
Constructor __construct (line 67)
  • access: public
TRpcClient __construct (string $serverUrl, [boolean $isNotification = false])
  • string $serverUrl: url to RPC server
  • boolean $isNotification: whether requests are considered to be notifications (completely ignoring the response) (default: false)
createStreamContext (line 93)

Creates a stream context resource

  • access: protected
void createStreamContext (mixed $content, string $contentType)
  • mixed $content
  • string $contentType: mime type
getIsNotification (line 123)
  • return: whether requests are considered to be notifications (completely ignoring the response)
  • access: public
boolean getIsNotification ()
getServerUrl (line 139)
  • return: url of the RPC server
  • access: public
string getServerUrl ()
performRequest (line 110)

Performs the actual request

  • access: protected
void performRequest (string $serverUrl, array $payload, string $mimeType)
  • string $serverUrl: RPC server URL
  • array $payload: payload data
  • string $mimeType: request mime type
setIsNotification (line 131)
  • access: public
void setIsNotification (string $bool)
  • string $bool: boolean whether the requests are considered to be notifications (completely ignoring the response) (default: false)
setServerUrl (line 147)
  • access: public
void setServerUrl (string $value)
  • string $value: url of the RPC server

Inherited Methods

Inherited From TApplicationComponent

TApplicationComponent::getApplication()
TApplicationComponent::getRequest()
TApplicationComponent::getResponse()
TApplicationComponent::getService()
TApplicationComponent::getSession()
TApplicationComponent::getUser()
TApplicationComponent::publishAsset()
TApplicationComponent::publishFilePath()

Inherited From TComponent

TComponent::addParsedObject()
TComponent::attachEventHandler()
TComponent::canGetProperty()
TComponent::canSetProperty()
TComponent::createdOnTemplate()
TComponent::detachEventHandler()
TComponent::evaluateExpression()
TComponent::evaluateStatements()
TComponent::getEventHandlers()
TComponent::getSubProperty()
TComponent::hasEvent()
TComponent::hasEventHandler()
TComponent::hasProperty()
TComponent::raiseEvent()
TComponent::setSubProperty()
TComponent::__call()
TComponent::__get()
TComponent::__set()
TComponent::__sleep()
TComponent::__wakeup()

Documentation generated on Mon, 25 Jun 2012 14:39:06 +0200 by phpDocumentor 1.4.3