Class TRpcClient
Direct Known Sub-classes:
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();
| Constructor Summary |
| public |
|
| Method Summary |
|
static
TRpcClient
|
create
( $type, $serverUrl, $isNotification)
Creates an instance of the requested RPC client type
|
|
protected
void
|
Creates a stream context resource
|
|
boolean
|
|
|
string
|
|
|
protected
void
|
Performs the actual request
|
|
void
|
|
|
void
|
|
| Methods 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()
|
| Constructor Details |
__construct
|
| Method Details |
create
| public static TRpcClient create |
( $type , $serverUrl , $isNotification ) |
Creates an instance of the requested RPC client type
| Input |
| $type | |
| $serverUrl | |
| $isNotification | |
| Output |
|
TRpcClient
| instance |
| Exception |
| throws | TApplicationException if an unsupported RPC client type was specified |
|
createStreamContext
| protected void createStreamContext |
(mixed $content , string $contentType ) |
Creates a stream context resource
| Input |
| mixed | $content | |
| string | $contentType | mime type |
| Output |
| Exception |
|
getIsNotification
| public boolean getIsNotification |
() |
| Output |
|
boolean
| whether requests are considered to be notifications (completely ignoring the response) |
| Exception |
|
getServerUrl
| public string getServerUrl |
() |
| Output |
|
string
| url of the RPC server |
| Exception |
|
performRequest
| protected void performRequest |
(string $serverUrl , array $payload , string $mimeType ) |
Performs the actual request
| Input |
| string | $serverUrl | RPC server URL |
| array | $payload | payload data |
| string | $mimeType | request mime type |
| Output |
| Exception |
|
setIsNotification
| public void setIsNotification |
(string $bool ) |
| Input |
| string | $bool | boolean whether the requests are considered to be notifications (completely ignoring the response) (default: false) |
| Output |
| Exception |
|
setServerUrl
| public void setServerUrl |
(string $value ) |
| Input |
| string | $value | url of the RPC server |
| Output |
| Exception |
|
|