Zend Framework
3.0
|
An XML-RPC server implementation. More...
Public Member Functions | |
__construct () | |
Constructor. | |
__call ($method, $params) | |
Proxy calls to system object. | |
addFunction ($function, $namespace= '') | |
Attach a callback as an XMLRPC method. | |
setClass ($class, $namespace= '', $argv=null) | |
Attach class methods as XMLRPC method handlers. | |
fault ($fault=null, $code=404) | |
Raise an xmlrpc server fault. | |
setReturnResponse ($flag=true) | |
Set return response flag. | |
getReturnResponse () | |
Retrieve return response flag. | |
handle ($request=false) | |
Handle an xmlrpc call. | |
loadFunctions ($definition) | |
Load methods as returned from getFunctions. | |
setEncoding ($encoding) | |
Set encoding. | |
getEncoding () | |
Retrieve current encoding. | |
setPersistence ($mode) | |
Do nothing; persistence is handled via Zend. | |
setRequest ($request) | |
Set the request object. | |
getRequest () | |
Return currently registered request object. | |
getResponse () | |
Last response. | |
setResponseClass ($class) | |
Set the class to use for the response. | |
getResponseClass () | |
Retrieve current response class. | |
getDispatchTable () | |
Retrieve dispatch table. | |
getFunctions () | |
Returns a list of registered methods. | |
getSystem () | |
Retrieve system object. | |
sendArgumentsToAllMethods ($flag=null) | |
Send arguments to all methods? | |
Public Member Functions inherited from AbstractServer | |
__construct () | |
Constructor. | |
getFunctions () | |
Returns a list of registered methods. | |
Protected Member Functions | |
_fixType ($type) | |
Map PHP type to XML-RPC type. | |
handleRequest (Request $request) | |
Handle an xmlrpc call (actual work) | |
registerSystemMethods () | |
Register system methods with the server. | |
Protected Member Functions inherited from AbstractServer | |
_buildCallback (Reflection\AbstractFunction $reflection) | |
Build callback for method signature. | |
_buildSignature (Reflection\AbstractFunction $reflection, $class=null) | |
Build a method signature. | |
_dispatch (Method\Definition $invokable, array $params) | |
Dispatch method. | |
_fixType ($type) | |
Map PHP type to protocol type. | |
Static Protected Member Functions | |
static | isSubclassOf ($className, $type) |
Checks if the object has this class as one of its parents. | |
Protected Attributes | |
$encoding = 'UTF-8' | |
$request = null | |
$responseClass = 'Zend\XmlRpc\Response\Http' | |
$table | |
$typeMap | |
$sendArgumentsToAllMethods = true | |
$returnResponse = false | |
$response | |
Protected Attributes inherited from AbstractServer | |
$overwriteExistingMethods = false | |
$table | |
An XML-RPC server implementation.
Example: use Zend;
// Instantiate server $server = new XmlRpc();
// Allow some exceptions to report as fault responses: XmlRpc::attachFaultException('My\Exception'); XmlRpc::attachObserver('My\Fault\Observer');
// Get or build dispatch table: if (!XmlRpc::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::save($filename, $server); }
$response = $server->handle(); echo $response;
__construct | ( | ) |
Constructor.
Creates system.* methods.
__call | ( | $method, | |
$params | |||
) |
Proxy calls to system object.
string | $method | |
array | $params |
Server\Exception\BadMethodCallException |
|
protected |
Map PHP type to XML-RPC type.
string | $type |
addFunction | ( | $function, | |
$namespace = '' |
|||
) |
Attach a callback as an XMLRPC method.
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 | callable | $function | Valid callback |
string | $namespace | Optional namespace prefix |
Server\Exception\InvalidArgumentException |
Implements Server.
fault | ( | $fault = null , |
|
$code = 404 |
|||
) |
getDispatchTable | ( | ) |
Retrieve dispatch table.
getEncoding | ( | ) |
Retrieve current encoding.
getFunctions | ( | ) |
getRequest | ( | ) |
Return currently registered request object.
getResponseClass | ( | ) |
Retrieve current response class.
getReturnResponse | ( | ) |
getSystem | ( | ) |
Retrieve system object.
handle | ( | $request = false | ) |
|
protected |
|
staticprotected |
Checks if the object has this class as one of its parents.
string | $className | |
string | $type |
loadFunctions | ( | $definition | ) |
Load methods as returned from getFunctions.
Typically, you will not use this method; it will be called using the results pulled from ::get().
array | Definition | $definition |
Server\Exception\InvalidArgumentException | on invalid input |
Implements Server.
|
protected |
Register system methods with the server.
sendArgumentsToAllMethods | ( | $flag = null | ) |
Send arguments to all methods?
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
bool | null | $flag |
setClass | ( | $class, | |
$namespace = '' , |
|||
$argv = null |
|||
) |
Attach class methods as XMLRPC method handlers.
$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 | $class | |
string | $namespace | Optional |
mixed | $argv | Optional arguments to pass to methods |
Server\Exception\InvalidArgumentException | on invalid input |
Implements Server.
setEncoding | ( | $encoding | ) |
setPersistence | ( | $mode | ) |
setRequest | ( | $request | ) |
setResponseClass | ( | $class | ) |
Set the class to use for the response.
string | $class |
Server\Exception\InvalidArgumentException | if invalid response class |
setReturnResponse | ( | $flag = true | ) |
Set return response flag.
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 | $flag |
Implements Server.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |