API Documentation

XmlRpc/Server.php

Includes Classes 
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_XmlRpc
subpackage
Server
version
$Id: Server.php 20096 2010-01-06 02:05:09Z bkarwin $
Classes
Zend_XmlRpc_Server

Description

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

Zend_XmlRpc_Server

Extends from
Zend_Server_Abstract
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_XmlRpc
subpackage
Server
Properties
$_encoding
$_request
$_responseClass
$_table
$_typeMap
$_sendArgumentsToAllMethods
Methods
__construct
__call
addFunction
setClass
fault
handle
loadFunctions
setEncoding
getEncoding
setPersistence
setRequest
getRequest
setResponseClass
getResponseClass
getDispatchTable
getFunctions
getSystem
sendArgumentsToAllMethods
_fixType
_handle
_registerSystemMethods

Description

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;

Properties

$_encoding

string $_encoding = 'UTF-8'

Character encoding

Details

$_encoding
string
visibility
protected
default
UTF-8
final
false
static
false

$_request

null|Zend_XmlRpc_Request $_request = 'null'

Request processed

Details

$_request
null|Zend_XmlRpc_Request
visibility
protected
default
null
final
false
static
false

$_responseClass

string $_responseClass = 'Zend_XmlRpc_Response_Http'

Class to use for responses; defaults to {@link Zend_XmlRpc_Response_Http}

Details

$_responseClass
string
visibility
protected
default
Zend_XmlRpc_Response_Http
final
false
static
false

$_sendArgumentsToAllMethods

bool $_sendArgumentsToAllMethods = 'true'

Send arguments to all methods or just constructor?

Details

$_sendArgumentsToAllMethods
bool
visibility
protected
default
true
final
false
static
false

$_table

Zend_Server_Definition $_table = ''

Dispatch table of name => method pairs

Details

$_table
Zend_Server_Definition
visibility
protected
default
final
false
static
false

$_typeMap

array $_typeMap = 'array'

PHP types => XML-RPC types

Details

$_typeMap
array
visibility
protected
default
array
final
false
static
false

Methods

__call

__call( string $method, array $params ) : mixed

Proxy calls to system object

Arguments
$method
string
$params
array
Output
mixed
Details
visibility
public
final
false
static
false
throws

__construct

__construct( ) : void

Constructor

Creates system.* methods.

Details
visibility
public
final
false
static
false

_fixType

_fixType( string $type ) : string

Map PHP type to XML-RPC type

Arguments
$type
string
Output
string
Details
visibility
protected
final
false
static
false

_handle

_handle( Zend_XmlRpc_Request $request ) : Zend_XmlRpc_Response

Handle an xmlrpc call (actual work)

Arguments
$request
Zend_XmlRpc_Request
Details
visibility
protected
final
false
static
false
throws
Zend_XmlRpcServer_Exceptions are thrown for internal errors; otherwise, any other exception may be thrown by the callback

_registerSystemMethods

_registerSystemMethods( ) : void

Register system methods with the server

Details
visibility
protected
final
false
static
false

addFunction

addFunction( string|array $function, string $namespace ) : void

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.

Arguments
$function
stringarray
Valid callback
$namespace
string
Optional namespace prefix
Details
visibility
public
final
false
static
false
throws

fault

fault( string|Exception $fault = null, int $code = 404 ) : Zend_XmlRpc_Server_Fault

Raise an xmlrpc server fault

Arguments
$fault
stringException
$code
int
Details
visibility
public
final
false
static
false

getDispatchTable

getDispatchTable( ) : array

Retrieve dispatch table

Output
array
Details
visibility
public
final
false
static
false

getEncoding

getEncoding( ) : string

Retrieve current encoding

Output
string
Details
visibility
public
final
false
static
false

getFunctions

getFunctions( ) : array

Returns a list of registered methods

Returns an array of dispatchables (Zend_Server_Reflection_Function, _Method, and _Class items).

Output
array
Details
visibility
public
final
false
static
false

getRequest

getRequest( ) : null|Zend_XmlRpc_Request

Return currently registered request object

Output
null|Zend_XmlRpc_Request
Details
visibility
public
final
false
static
false

getResponseClass

getResponseClass( ) : string

Retrieve current response class

Output
string
Details
visibility
public
final
false
static
false

getSystem

getSystem( ) : Zend_XmlRpc_Server_System

Retrieve system object

Details
visibility
public
final
false
static
false

handle

handle( Zend_XmlRpc_Request $request = false ) : Zend_XmlRpc_Response|Zend_XmlRpc_Fault

Handle an xmlrpc call

Arguments
$request
Zend_XmlRpc_Request
Optional
Details
visibility
public
final
false
static
false

loadFunctions

loadFunctions( array|Zend_Server_Definition $definition ) : void

Load methods as returned from {@link getFunctions}

Typically, you will not use this method; it will be called using the results pulled from {@link Zend_XmlRpc_Server_Cache::get()}.

Arguments
$definition
arrayZend_Server_Definition
Details
visibility
public
final
false
static
false
throws
on invalid input

sendArgumentsToAllMethods

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

Arguments
$flag
Details
visibility
public
final
false
static
false

setClass

setClass( string|object $class, string $namespace, mixed $argv = null ) : 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.

Arguments
$class
stringobject
$namespace
string
Optional
$argv
mixed
Optional arguments to pass to methods
Details
visibility
public
final
false
static
false
throws
on invalid input

setEncoding

setEncoding( string $encoding ) : Zend_XmlRpc_Server

Set encoding

Arguments
$encoding
string
Details
visibility
public
final
false
static
false

setPersistence

setPersistence( mixed $mode ) : void

Do nothing; persistence is handled via {@link Zend_XmlRpc_Server_Cache}

Arguments
$mode
mixed
Details
visibility
public
final
false
static
false

setRequest

setRequest( string|Zend_XmlRpc_Request $request ) : Zend_XmlRpc_Server

Set the request object

Arguments
$request
stringZend_XmlRpc_Request
Details
visibility
public
final
false
static
false
throws
on invalid request class or object

setResponseClass

setResponseClass( string $class ) : boolean

Set the class to use for the response

Arguments
$class
string
Output
boolean
True if class was set, false if not
Details
visibility
public
final
false
static
false
Documentation was generated by DocBlox.