__call()
__construct()
addFunction()
fault()
getDispatchTable()
getEncoding()
getFunctions()
getRequest()
getResponse()
getResponseClass()
getReturnResponse()
getSystem()
handle()
loadFunctions()
sendArgumentsToAllMethods()
setClass()
setEncoding()
setPersistence()
setRequest()
setResponseClass()
setReturnResponse()
_buildCallback()
_buildSignature()
_dispatch()
_fixType()
handleRequest()
isSubclassOf()
registerSystemMethods()
$encoding
$overwriteExistingMethods
$request
$response
$responseClass
$returnResponse
$sendArgumentsToAllMethods
$table
$typeMap
An XML-RPC server implementation
Example:
use Zend\XmlRpc;
// Instantiate server
$server = new XmlRpc\Server();
// Allow some exceptions to report as fault responses:
XmlRpc\Server\Fault::attachFaultException('My\\Exception');
XmlRpc\Server\Fault::attachObserver('My\\Fault\\Observer');
// Get or build dispatch table:
if (!XmlRpc\Server\Cache::get($filename, $server)) {
// Attach Some_Service_Class in 'some' namespace
$server->setClass('Some\\Service\\Class', 'some');
// Attach Another_Service_Class in 'another' namespace
$server->setClass('Another\\Service\\Class', 'another');
// Create dispatch table cache file
XmlRpc\Server\Cache::save($filename, $server);
}
$response = $server->handle();
echo $response;
__call(string $method, array $params) : mixed
string
array
\Zend\XmlRpc\Server\Exception\BadMethodCallException |
---|
mixed
__construct()
Creates system.* methods.
addFunction(string | array | \Zend\XmlRpc\callable $function, string $namespace) : void
Attaches a callback as an XMLRPC method, prefixing the XMLRPC method name with $namespace, if provided. Reflection is done on the callback's docblock to create the methodHelp for the XMLRPC method.
Additional arguments to pass to the function at dispatch may be passed; any arguments following the namespace will be aggregated and passed at dispatch time.
stringarray\Zend\XmlRpc\callable
Valid callback
string
Optional namespace prefix
\Zend\XmlRpc\Server\Exception\InvalidArgumentException |
---|
fault(string | \Exception $fault, int $code) : \Zend\XmlRpc\Server\Fault
getDispatchTable() : array
array
getEncoding() : string
string
getFunctions() : array
Returns an array of dispatchables (Zend\Server\Reflection\ReflectionFunction, ReflectionMethod, and ReflectionClass items).
array
getResponseClass() : string
string
getReturnResponse() : bool
bool
handle(\Zend\XmlRpc\Request $request) : \Zend\XmlRpc\Response | \Zend\XmlRpc\Fault
Requests may be passed in, or the server may automatically determine the request based on defaults. Dispatches server request to appropriate method and returns a response
loadFunctions(array | \Zend\Server\Definition $definition) : void
Typically, you will not use this method; it will be called using the results pulled from Zend\XmlRpc\Server\Cache::get().
array\Zend\Server\Definition
\Zend\XmlRpc\Server\Exception\InvalidArgumentException |
on invalid input |
---|
sendArgumentsToAllMethods(bool | null $flag) : \Zend\XmlRpc\self
If setClass() is used to add classes to the server, this flag defined how to handle arguments. If set to true, all methods including constructor will receive the arguments. If set to false, only constructor will receive the arguments
boolnull
\Zend\XmlRpc\self
setClass(string | object $class, string $namespace, mixed $argv) : void
$class may be either a class name or an object. Reflection is done on the class or object to determine the available public methods, and each is attached to the server as an available method; if a $namespace has been provided, that namespace is used to prefix the XMLRPC method names.
Any additional arguments beyond $namespace will be passed to a method at invocation.
stringobject
string
Optional
mixed
Optional arguments to pass to methods
\Zend\XmlRpc\Server\Exception\InvalidArgumentException |
on invalid input |
---|
setPersistence(mixed $mode) : void
mixed
setRequest(string | \Zend\XmlRpc\Request $request) : \Zend\XmlRpc\Server
string\Zend\XmlRpc\Request
\Zend\XmlRpc\Server\Exception\InvalidArgumentException |
on invalid request class or object |
---|
setResponseClass(string $class) : bool
string
\Zend\XmlRpc\Server\Exception\InvalidArgumentException |
if invalid response class |
---|
bool
True if class was set, false if notsetReturnResponse(bool $flag) : \Zend\XmlRpc\Server
If true, handle() will return the response instead of automatically sending it back to the requesting client.
The response is always available via getResponse().
bool
_buildCallback(\Zend\Server\Reflection\AbstractFunction $reflection) : \Zend\Server\Method\Callback
inherited_from | \Zend\Server\AbstractServer::_buildCallback() |
---|
\Zend\Server\Reflection\AbstractFunction
_buildSignature(\Zend\Server\Reflection\AbstractFunction $reflection, null | string | object $class) : \Zend\Server\Method\Definition
inherited_from | \Zend\Server\AbstractServer::_buildSignature() |
---|
\Zend\Server\Reflection\AbstractFunction
nullstringobject
\Zend\Server\Exception\RuntimeException |
on duplicate entry |
---|
_dispatch(\Zend\Server\Method\Definition $invokable, array $params) : mixed
inherited_from | \Zend\Server\AbstractServer::_dispatch() |
---|
\Zend\Server\Method\Definition
array
mixed
_fixType(string $type) : string
string
string
handleRequest(\Zend\XmlRpc\Request $request) : \Zend\XmlRpc\Response
\Zend\XmlRpc\Request
\Zend\XmlRpc\Server\Exception\RuntimeException |
Zend\XmlRpc\Server\Exceptions are thrown for internal errors; otherwise, any other exception may be thrown by the callback |
---|
isSubclassOf(string $className, string $type) : bool
see | \Zend\XmlRpc\https://bugs.php.net/bug.php?id=53727 |
---|---|
see | \Zend\XmlRpc\https://github.com/zendframework/zf2/pull/1807 |
deprecated | since zf 2.3 requires PHP >= 5.3.23 |
string
string
bool
registerSystemMethods() : void
$encoding : string
$overwriteExistingMethods : bool
inherited_from | \Zend\Server\AbstractServer::$$overwriteExistingMethods |
---|
$responseClass : string
$returnResponse : bool
$sendArgumentsToAllMethods : bool
$typeMap : array