An XML-RPC server implementation
Example:
require_once 'Zend/XmlRpc/Server.php';
require_once 'Zend/XmlRpc/Server/Cache.php';
require_once 'Zend/XmlRpc/Server/Fault.php';
require_once 'My/Exception.php';
require_once 'My/Fault/Observer.php';
// Instantiate server $server = new Zend_XmlRpc_Server();
// Allow some exceptions to report as fault responses: Zend_XmlRpc_Server_Fault::attachFaultException('My_Exception'); Zend_XmlRpc_Server_Fault::attachObserver('My_Fault_Observer');
// Get or build dispatch table: if (!Zend_XmlRpc_Server_Cache::get($filename, $server)) { require_once 'Some/Service/Class.php'; require_once 'Another/Service/Class.php';
// 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
Zend_XmlRpc_Server_Cache::save($filename, $server);
}
$response = $server->handle(); echo $response;
category | Zend |
---|---|
package | Zend_XmlRpc |
subpackage | Server |
copyright | Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) |
license | New BSD License |
inherited_from | \Zend_Server_Abstract |
__call(string $method, array $params) : mixed
string
array
\Zend_XmlRpc_Server_Exception |
---|
mixed
__construct() : void
Creates system.* methods.
inherited_from | \Zend_Server_Abstract::__construct() |
---|
__construct() : void
Setup server description
addFunction(string|array $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.
string
array
Valid callback
string
Optional namespace prefix
\Zend_XmlRpc_Server_Exception |
---|
fault(string|\Exception $fault= null
, integer $code= 404
) : \Zend_XmlRpc_Server_Fault
string
\Exception
integer
\Zend_XmlRpc_Server_Fault
getDispatchTable() : array
array
getEncoding() : string
string
getFunctions() : array
Returns an array of dispatchables (Zend_Server_Reflection_Function, _Method, and _Class items).
inherited_from | \Zend_Server_Abstract::getFunctions() |
---|
array
getFunctions() : \Zend_Server_Definition
Returns an array of method definitions.
inherited_from | \Zend_Server_Interface::getFunctions() |
---|
\Zend_Server_Definition
getRequest() : null | \Zend_XmlRpc_Request
null
\Zend_XmlRpc_Request
getResponseClass() : string
string
getSystem() : \Zend_XmlRpc_Server_System
\Zend_XmlRpc_Server_System
handle(\Zend_XmlRpc_Request $request = false
) : \Zend_XmlRpc_Response | \Zend_XmlRpc_Fault
\Zend_XmlRpc_Request
Optional
\Zend_XmlRpc_Response
\Zend_XmlRpc_Fault
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 |
on invalid input |
---|
lowerCase($value, string $key) : string
Lowercase's a string by reference
deprecated |
---|
string
string
Lower cased stringsendArgumentsToAllMethods($flag = null
)
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
setClass(string|object $class, string $namespace= ''
, mixed $argv= null
) : 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.
string
object
string
Optional
mixed
Optional arguments to pass to methods
\Zend_XmlRpc_Server_Exception |
on invalid input |
---|
setEncoding(string $encoding) : \Zend_XmlRpc_Server
string
\Zend_XmlRpc_Server
setPersistence(mixed $mode) : void
mixed
setRequest(string|\Zend_XmlRpc_Request $request) : \Zend_XmlRpc_Server
string
\Zend_XmlRpc_Request
\Zend_XmlRpc_Server_Exception |
on invalid request class or object |
---|
\Zend_XmlRpc_Server
setResponseClass(string $class) : boolean
string
boolean
True if class was set, false if not_buildCallback(\Zend_Server_Reflection_Function_Abstract $reflection) : \Zend_Server_Method_Callback
\Zend_Server_Reflection_Function_Abstract
\Zend_Server_Method_Callback
_buildSignature(\Zend_Server_Reflection_Function_Abstract $reflection, null|string|object $class = null
) : \Zend_Server_Method_Definition
\Zend_Server_Reflection_Function_Abstract
null
string
object
\Zend_Server_Exception |
on duplicate entry |
---|
\Zend_Server_Method_Definition
_dispatch(\Zend_Server_Method_Definition $invocable, array $params) : mixed
\Zend_Server_Method_Definition
array
mixed
_fixType(string $type) : string
inherited_from | \Zend_Server_Abstract::_fixType() |
---|
string
string
_fixType(string $type) : string
string
string
_handle(\Zend_XmlRpc_Request $request) : \Zend_XmlRpc_Response
\Zend_XmlRpc_Request
\Zend_XmlRpcServer_Exception \Exception
|
Zend_XmlRpcServer_Exceptions are thrown for internal errors; otherwise, any other exception may be thrown by the callback |
---|
\Zend_XmlRpc_Response
_registerSystemMethods() : void
$_encoding : string
'UTF-8'
$_overwriteExistingMethods : boolean
false
$_request : null | \Zend_XmlRpc_Request
null
$_responseClass : string
'Zend_XmlRpc_Response_Http'
$_sendArgumentsToAllMethods : boolean
true
$_table : \Zend_Server_Definition
inherited_from | \Zend_Server_Abstract::_table |
---|
$_table : \Zend_Server_Definition
$_typeMap : array
array('i4' => 'i4', 'int' => 'int', 'integer' => 'int', 'Zend_Crypt_Math_BigInteger' => 'i8', 'i8' => 'i8', 'ex:i8' => 'i8', 'double' => 'double', 'float' => 'double', 'real' => 'double', 'boolean' => 'boolean', 'bool' => 'boolean', 'true' => 'boolean', 'false' => 'boolean', 'string' => 'string', 'str' => 'string', 'base64' => 'base64', 'dateTime.iso8601' => 'dateTime.iso8601', 'date' => 'dateTime.iso8601', 'time' => 'dateTime.iso8601', 'time' => 'dateTime.iso8601', 'Zend_Date' => 'dateTime.iso8601', 'DateTime' => 'dateTime.iso8601', 'array' => 'array', 'struct' => 'struct', 'null' => 'nil', 'nil' => 'nil', 'ex:nil' => 'nil', 'void' => 'void', 'mixed' => 'struct')
$magic_methods : array
array('__call', '__clone', '__construct', '__destruct', '__get', '__isset', '__set', '__set_state', '__sleep', '__tostring', '__unset', '__wakeup')
deprecated |
---|