ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
XML_RPC2_Backend_Xmlrpcext_Server Class Reference
+ Inheritance diagram for XML_RPC2_Backend_Xmlrpcext_Server:
+ Collaboration diagram for XML_RPC2_Backend_Xmlrpcext_Server:

Public Member Functions

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

Protected Member Functions

 epiFunctionHandlerAdapter ($method_name, $params, $app_data)
 This is an adapter between XML_RPC2_CallHandler::__call and xmlrpc_server_register_method callback interface. More...
 
- Protected Member Functions inherited from XML_RPC2_Server
 __construct ($callHandler, $options=array())
 Create a new XML-RPC Server. More...
 
 getContentLength ($content)
 Gets the content legth of a serialized XML-RPC message in bytes. More...
 

Private Attributes

 $_xmlrpcextServer
 

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. More...
 
static errorToException ($errno, $errstr, $errfile, $errline)
 Transform an error into an exception. More...
 
- 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

◆ __construct()

XML_RPC2_Backend_Xmlrpcext_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

Reimplemented from XML_RPC2_Server.

Definition at line 88 of file Server.php.

89 {
90 parent::__construct($callHandler, $options);
91 $this->_xmlrpcextServer = xmlrpc_server_create();
92 foreach ($callHandler->getMethods() as $method) {
93 if (xmlrpc_server_register_method($this->_xmlrpcextServer,
94 $method->getName(),
95 array($this, 'epiFunctionHandlerAdapter')) !== true) {
96 throw new XML_RPC2_Exception('Unable to setup XMLRPCext server. xmlrpc_server_register_method returned non-true.');
97 }
98 }
99 }
if(!is_array($argv)) $options

References XML_RPC2_Server\$callHandler, and $options.

Member Function Documentation

◆ epiFunctionHandlerAdapter()

XML_RPC2_Backend_Xmlrpcext_Server::epiFunctionHandlerAdapter (   $method_name,
  $params,
  $app_data 
)
protected

This is an adapter between XML_RPC2_CallHandler::__call and xmlrpc_server_register_method callback interface.

Parameters
stringMethod name
arrayParameters
arrayApplication data (ignored)

Definition at line 111 of file Server.php.

111 {
112 return @call_user_func_array(array($this->callHandler, $method_name), $params);
113 }
$params
Definition: example_049.php:96

References $params.

◆ getResponse()

XML_RPC2_Backend_Xmlrpcext_Server::getResponse ( )

get the XML response of the XMLRPC server

Returns
string the XML response

Definition at line 144 of file Server.php.

145 {
146 try {
147 if ($this->signatureChecking) {
148 $tmp = xmlrpc_parse_method_descriptions($GLOBALS['HTTP_RAW_POST_DATA']);
149 $methodName = $tmp['methodName'];
150 $parameters = xmlrpc_decode($GLOBALS['HTTP_RAW_POST_DATA'], $this->encoding);
151 $method = $this->callHandler->getMethod($methodName);
152 if (!($method)) {
153 // see http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php for standard error codes
154 return (XML_RPC2_Backend_Php_Response::encodeFault(-32601, 'server error. requested method not found'));
155 }
156 if (!($method->matchesSignature($methodName, $parameters))) {
157 return (XML_RPC2_Backend_Php_Response::encodeFault(-32602, 'server error. invalid method parameters'));
158 }
159 }
160 set_error_handler(array('XML_RPC2_Backend_Xmlrpcext_Server', 'errorToException'));
161 $response = @xmlrpc_server_call_method($this->_xmlrpcextServer,
162 $GLOBALS['HTTP_RAW_POST_DATA'],
163 null,
164 array('output_type' => 'xml', 'encoding' => $this->encoding));
165 restore_error_handler();
166 return $response;
167 } catch (XML_RPC2_FaultException $e) {
168 return (XML_RPC2_Backend_Php_Response::encodeFault($e->getFaultCode(), $e->getMessage()));
169 } catch (Exception $e) {
170 return (XML_RPC2_Backend_Php_Response::encodeFault(1, 'Unhandled ' . get_class($e) . ' exception:' . $e->getMessage()));
171 }
172 }
static encodeFault($code, $message, $encoding='iso-8859-1')
Encode a fault XML-RPC response, containing the provided code and message.
Definition: Response.php:102
getFaultCode()
FaultCode getter.
Definition: Exception.php:229
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276

References $GLOBALS, XML_RPC2_Backend_Php_Response\encodeFault(), and XML_RPC2_FaultException\getFaultCode().

Referenced by handleCall().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleCall()

XML_RPC2_Backend_Xmlrpcext_Server::handleCall ( )

Respond to the XML-RPC request.

handleCall reads the XML-RPC request from the raw HTTP body and decodes it. It then calls the corresponding method in the call handler class, returning the encoded result to the client.

Reimplemented from XML_RPC2_Server.

Definition at line 124 of file Server.php.

125 {
126 if ((!($this->autoDocument)) or ((isset($GLOBALS['HTTP_RAW_POST_DATA'])) && (strlen($GLOBALS['HTTP_RAW_POST_DATA'])>0))) {
127 $response = $this->getResponse();
128 header('Content-type: text/xml; charset=' . $this->encoding);
129 header('Content-length: ' . $this->getContentLength($response));
130 print $response;
131 } else {
132 $this->autoDocument();
133 }
134 }
getResponse()
get the XML response of the XMLRPC server
Definition: Server.php:144
getContentLength($content)
Gets the content legth of a serialized XML-RPC message in bytes.
Definition: Server.php:318
if(! $in) print

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

+ Here is the call graph for this function:

Field Documentation

◆ $_xmlrpcextServer

XML_RPC2_Backend_Xmlrpcext_Server::$_xmlrpcextServer
private

Definition at line 74 of file Server.php.


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