ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
XML_RPC2_Server Class Reference
+ Inheritance diagram for XML_RPC2_Server:
+ Collaboration diagram for XML_RPC2_Server:

Public Member Functions

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

Static Public Member Functions

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

 __construct ($callHandler, $options=array())
 Create a new XML-RPC Server.
 getContentLength ($content)
 Gets the content legth of a serialized XML-RPC message in bytes.

Protected Attributes

 $callHandler = null
 $prefix = ''
 $encoding = 'iso-8859-1'
 $autoDocument = true
 $autoDocumentExternalLinks = true
 $signatureChecking = true

Detailed Description

Definition at line 97 of file Server.php.

Constructor & Destructor Documentation

XML_RPC2_Server::__construct (   $callHandler,
  $options = array() 
)
protected

Create a new XML-RPC Server.

Parameters
object$callHandlerthe call handler will receive a method call for each remote call received.
arrayassociative array of options

Reimplemented in XML_RPC2_Backend_Xmlrpcext_Server, and XML_RPC2_Backend_Php_Server.

Definition at line 160 of file Server.php.

References $callHandler, $options, and autoDocument().

{
$this->callHandler = $callHandler;
if ((isset($options['prefix'])) && (is_string($options['prefix']))) {
$this->prefix = $options['prefix'];
}
if ((isset($options['encoding'])) && (is_string($options['encoding']))) {
$this->encoding = $options['encoding'];
}
if ((isset($options['autoDocument'])) && (is_bool($options['autoDocument']))) {
$this->autoDocument = $options['autoDocument'];
}
if ((isset($options['autoDocumentExternalLinks'])) && (is_bool($options['autoDocumentExternalLinks']))) {
$this->autoDocumentExternalLinks = $options['autoDocumentExternalLinks'];
}
if ((isset($options['signatureChecking'])) && (is_bool($options['signatureChecking']))) {
$this->signatureChecking = $options['signatureChecking'];
}
}

+ Here is the call graph for this function:

Member Function Documentation

XML_RPC2_Server::autoDocument ( )

autoDocument.

Produce an HTML page from the result of server introspection

Returns
string HTML document describing this server

Definition at line 260 of file Server.php.

Referenced by __construct(), XML_RPC2_Backend_Php_Server\handleCall(), and XML_RPC2_Backend_Xmlrpcext_Server\handleCall().

{
print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
print "<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\">\n";
print " <head>\n";
print " <meta http-equiv=\"Content-Type\" content=\"text/HTML; charset=" . $this->encoding . "\" />\n";
print " <title>Available XMLRPC methods for this server</title>\n";
print " <style type=\"text/css\">\n";
print " li,p { font-size: 10pt; font-family: Arial,Helvetia,sans-serif; }\n";
print " a:link { background-color: white; color: blue; text-decoration: underline; font-weight: bold; }\n";
print " a:visited { background-color: white; color: blue; text-decoration: underline; font-weight: bold; }\n";
print " table { border-collapse:collapse; width: 100% }\n";
print " table,td { padding: 5px; border: 1px solid black; }\n";
print " div.bloc { border: 1px dashed gray; padding: 10px; margin-bottom: 20px; }\n";
print " div.description { border: 1px solid black; padding: 10px; }\n";
print " span.type { background-color: white; color: gray; font-weight: normal; }\n";
print " span.paratype { background-color: white; color: gray; font-weight: normal; }\n";
print " span.name { background-color: white; color: #660000; }\n";
print " span.paraname { background-color: white; color: #336600; }\n";
print " img { border: 0px; }\n";
print " li { font-size: 12pt; }\n";
print " </style>\n";
print " </head>\n";
print " <body>\n";
print " <h1>Available XMLRPC methods for this server</h1>\n";
print " <h2><a name=\"index\">Index</a></h2>\n";
print " <ul>\n";
foreach ($this->callHandler->getMethods() as $method) {
$name = $method->getName();
$id = md5($name);
$signature = $method->getHTMLSignature();
print " <li><a href=\"#$id\">$name()</a></li>\n";
}
print " </ul>\n";
print " <h2>Details</h2>\n";
foreach ($this->callHandler->getMethods() as $method) {
print " <div class=\"bloc\">\n";
$method->autoDocument();
print " <p>(return to <a href=\"#index\">index</a>)</p>\n";
print " </div>\n";
}
if (!($this->autoDocumentExternalLinks)) {
print ' <p><a href="http://pear.php.net/packages/XML_RPC2"><img src="http://pear.php.net/gifs/pear-power.png" alt="Powered by PEAR/XML_RPC2" height="31" width="88" /></a> &nbsp; &nbsp; &nbsp; <a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Strict" height="31" width="88" /></a> &nbsp; &nbsp; &nbsp; <a href="http://jigsaw.w3.org/css-validator/"><img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!" /></a></p>' . "\n";
}
print " </body>\n";
print "</html>\n";
}

+ Here is the caller graph for this function:

static XML_RPC2_Server::create (   $callTarget,
  $options = array() 
)
static

Factory method to select a backend and return a new XML_RPC2_Server based on the backend.

Parameters
mixed$callTargeteither a class name or an object instance.
arrayassociative array of options
Returns
object a server class instance

Definition at line 190 of file Server.php.

References $callHandler, $options, $prefix, XML_RPC2_Backend\getServerClassname(), and XML_RPC2_Backend\setBackend().

{
if (isset($options['backend'])) {
}
if (isset($options['prefix'])) {
$prefix = $options['prefix'];
} else {
$prefix = '';
}
// Find callHandler class
if (!isset($options['callHandler'])) {
if (is_object($callTarget)) { // Delegate calls to instance methods
require_once 'XML/RPC2/Server/CallHandler/Instance.php';
$callHandler = new XML_RPC2_Server_CallHandler_Instance($callTarget, $prefix);
} else { // Delegate calls to static class methods
require_once 'XML/RPC2/Server/CallHandler/Class.php';
$callHandler = new XML_RPC2_Server_CallHandler_Class($callTarget, $prefix);
}
} else {
$callHandler = $options['callHandler'];
}
return new $backend($callHandler, $options);
}

+ Here is the call graph for this function:

static XML_RPC2_Server::errorToException (   $errno,
  $errstr,
  $errfile,
  $errline 
)
static

Transform an error into an exception.

Parameters
int$errnoerror number
string$errstrerror string
string$errfileerror file
int$errlineerror line

Definition at line 236 of file Server.php.

{
switch ($errno) {
case E_WARNING:
case E_NOTICE:
case E_USER_WARNING:
case E_USER_NOTICE:
case E_STRICT:
// Silence warnings
// TODO Logging should occur here
break;
default:
throw new Exception('Classic error reported "' . $errstr . '" on ' . $errfile . ':' . $errline);
}
}
XML_RPC2_Server::getContentLength (   $content)
protected

Gets the content legth of a serialized XML-RPC message in bytes.

Parameters
string$contentthe serialized XML-RPC message.
Returns
integer the content length in bytes.

Definition at line 318 of file Server.php.

Referenced by XML_RPC2_Backend_Php_Server\handleCall(), and XML_RPC2_Backend_Xmlrpcext_Server\handleCall().

{
if (extension_loaded('mbstring') && (ini_get('mbstring.func_overload') & 2) == 2) {
$length = mb_strlen($content, '8bit');
} else {
$length = strlen((binary)$content);
}
return $length;
}

+ Here is the caller graph for this function:

XML_RPC2_Server::handleCall ( )
abstract

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

Reimplemented in XML_RPC2_Backend_Xmlrpcext_Server, and XML_RPC2_Backend_Php_Server.

Field Documentation

XML_RPC2_Server::$autoDocument = true
protected

Definition at line 132 of file Server.php.

XML_RPC2_Server::$autoDocumentExternalLinks = true
protected

Definition at line 139 of file Server.php.

XML_RPC2_Server::$callHandler = null
protected
XML_RPC2_Server::$encoding = 'iso-8859-1'
protected

Definition at line 125 of file Server.php.

Referenced by XML_RPC2_Backend_Php_Server\getResponse().

XML_RPC2_Server::$prefix = ''
protected

Definition at line 116 of file Server.php.

Referenced by create().

XML_RPC2_Server::$signatureChecking = true
protected

Definition at line 149 of file Server.php.


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