ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
XML_RPC2_Backend_Php_Server Class Reference
+ Inheritance diagram for XML_RPC2_Backend_Php_Server:
+ Collaboration diagram for XML_RPC2_Backend_Php_Server:

Public Member Functions

 __construct ($callHandler, $options=array())
 Create a new XML-RPC Server.
 handleCall ()
 Receive the XML-RPC request, decode the HTTP payload, delegate execution to the call handler, and output the encoded call handler response.
 getResponse ()
 Get the XML response of the XMLRPC server.
- Public Member Functions inherited from XML_RPC2_Server
 autoDocument ()
 autoDocument.

Additional Inherited Members

- Static Public Member Functions inherited from XML_RPC2_Server
static create ($callTarget, $options=array())
 Factory method to select a backend and return a new XML_RPC2_Server based on the backend.
static errorToException ($errno, $errstr, $errfile, $errline)
 Transform an error into an exception.
- Protected Member Functions inherited from XML_RPC2_Server
 getContentLength ($content)
 Gets the content legth of a serialized XML-RPC message in bytes.
- Protected Attributes inherited from XML_RPC2_Server
 $callHandler = null
 $prefix = ''
 $encoding = 'iso-8859-1'
 $autoDocument = true
 $autoDocumentExternalLinks = true
 $signatureChecking = true

Detailed Description

Definition at line 64 of file Server.php.

Constructor & Destructor Documentation

XML_RPC2_Backend_Php_Server::__construct (   $callHandler,
  $options = array() 
)

Create a new XML-RPC Server.

The constructor receives a mandatory parameter: the Call Handler. The call handler executes the actual method call. XML_RPC2 server acts as a protocol decoder/encoder between the call handler and the client

Parameters
object$callHandler
array$optionsassociative array of options public

Reimplemented from XML_RPC2_Server.

Definition at line 79 of file Server.php.

References XML_RPC2_Server\$callHandler.

Member Function Documentation

XML_RPC2_Backend_Php_Server::getResponse ( )

Get the XML response of the XMLRPC server.

Returns
string XML response

Definition at line 111 of file Server.php.

References XML_RPC2_Server\$encoding, $GLOBALS, XML_RPC2_Backend_Php_Request\createFromDecode(), XML_RPC2_Backend_Php_Response\encode(), XML_RPC2_Backend_Php_Response\encodeFault(), and XML_RPC2_FaultException\getFaultCode().

Referenced by handleCall().

{
try {
set_error_handler(array('XML_RPC2_Backend_Php_Server', 'errorToException'));
$request = @simplexml_load_string($GLOBALS['HTTP_RAW_POST_DATA']);
// TODO : do not use exception but a XMLRPC error !
if (!is_object($request)) throw new XML_RPC2_FaultException('Unable to parse request XML', 0);
$methodName = $request->getMethodName();
$arguments = $request->getParameters();
if ($this->signatureChecking) {
$method = $this->callHandler->getMethod($methodName);
if (!($method)) {
// see http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php for standard error codes
return (XML_RPC2_Backend_Php_Response::encodeFault(-32601, 'server error. requested method not found'));
}
if (!($method->matchesSignature($methodName, $arguments))) {
return (XML_RPC2_Backend_Php_Response::encodeFault(-32602, 'server error. invalid method parameters'));
}
}
restore_error_handler();
return (XML_RPC2_Backend_Php_Response::encode(call_user_func_array(array($this->callHandler, $methodName), $arguments), $this->encoding));
} catch (XML_RPC2_FaultException $e) {
} catch (Exception $e) {
return (XML_RPC2_Backend_Php_Response::encodeFault(1, 'Unhandled ' . get_class($e) . ' exception:' . $e->getMessage() . $e->getTraceAsString(), $this->encoding));
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

XML_RPC2_Backend_Php_Server::handleCall ( )

Receive the XML-RPC request, decode the HTTP payload, delegate execution to the call handler, and output the encoded call handler response.

Reimplemented from XML_RPC2_Server.

Definition at line 91 of file Server.php.

References $GLOBALS, XML_RPC2_Server\autoDocument(), XML_RPC2_Server\getContentLength(), and getResponse().

{
if ((!($this->autoDocument)) or ((isset($GLOBALS['HTTP_RAW_POST_DATA'])) && (strlen($GLOBALS['HTTP_RAW_POST_DATA'])>0))) {
$response = $this->getResponse();
header('Content-type: text/xml; charset=' . $this->encoding);
header('Content-length: ' . $this->getContentLength($response));
print $response;
} else {
$this->autoDocument();
}
}

+ Here is the call graph for this function:


The documentation for this class was generated from the following file: