An XML-RPC server implementation
Example: <code> use ZendXmlRpc;
// Instantiate server $server = new XmlRpcServer();
// Allow some exceptions to report as fault responses: XmlRpcServerFault::attachFaultException(‘My\Exception’); XmlRpcServerFault::attachObserver(‘My\Fault\Observer’);
// Get or build dispatch table: if (!XmlRpcServerCache::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 XmlRpcServerCache::save($filename, $server);
}
$response = $server->handle(); echo $response; </code>
Proxy calls to system object
Parameters: |
|
---|---|
Return type: | mixed |
Throws : | ServerExceptionBadMethodCallException |
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.
Parameters: |
|
---|---|
Throws ServerExceptionInvalidArgumentException: | |
Return type: | void |
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.
Parameters: |
|
---|---|
Return type: | void |
Throws : | ServerExceptionInvalidArgumentException on invalid input |
Raise an xmlrpc server fault
Parameters: |
|
---|---|
Return type: | ServerFault |
Handle an xmlrpc call
Parameters: | Request – Optional |
---|---|
Return type: | Response|Fault |
Load methods as returned from {@link getFunctions}
Typically, you will not use this method; it will be called using the results pulled from {@link ZendXmlRpcServerCache::get()}.
Parameters: | array|Definition – |
---|---|
Return type: | void |
Throws : | ServerExceptionInvalidArgumentException on invalid input |
Set the request object
Parameters: | string|Request – |
---|---|
Return type: | Server |
Throws : | ServerExceptionInvalidArgumentException on invalid request class or object |
Return currently registered request object
Return type: | null|Request |
---|
Set the class to use for the response
Parameters: | string – |
---|---|
Throws ServerExceptionInvalidArgumentException: | |
if invalid response class | |
Return type: | bool True if class was set, false if not |
Retrieve current response class
Return type: | string |
---|
Returns a list of registered methods
Returns an array of dispatchables (ZendServerReflectionReflectionFunction, ReflectionMethod, and ReflectionClass items).
Return type: | array |
---|
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
Map PHP type to XML-RPC type
Parameters: | string – |
---|---|
Return type: | string |
Handle an xmlrpc call (actual work)
Parameters: | Request – |
---|---|
Return type: | Response |
Throws : | ServerExceptionRuntimeException ZendXmlRpcServerExceptions are thrown for internal errors; otherwise, |
any other exception may be thrown by the callback