ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
XML_RPC2_Client Class Reference
+ Inheritance diagram for XML_RPC2_Client:
+ Collaboration diagram for XML_RPC2_Client:

Public Member Functions

 remoteCall___ ($methodName, $parameters)
 remoteCall executes the XML-RPC call, and returns the result
 __call ($methodName, $parameters)
 __call Catchall.

Static Public Member Functions

static create ($uri, $options=array())
 Factory method to select, create and return a XML_RPC2_Client backend.

Data Fields

const VERSION = '1.0.4'

Protected Member Functions

 __construct ($uri, $options=array())
 Construct a new XML_RPC2_Client.
 displayDebugInformations___ ($request, $body)
 Display debug informations.
 displayDebugInformations2___ ($result)
 Display debug informations (part 2)
 testMethodName___ ($methodName)
 Return true is the given method name is ok with XML/RPC spec.

Protected Attributes

 $uri = null
 $proxy = null
 $prefix = null
 $debug = false
 $encoding = 'iso-8859-1'
 $sslverify = true
 $uglyStructHack = true
 ugly hack flag to avoid http://bugs.php.net/bug.php?id=21949

Detailed Description

Definition at line 72 of file Client.php.

Constructor & Destructor Documentation

XML_RPC2_Client::__construct (   $uri,
  $options = array() 
)
protected

Construct a new XML_RPC2_Client.

To create a new XML_RPC2_Client, a URI must be provided (e.g. http://xmlrpc.example.com/1.0/). Optionally, some options may be set as an associative array. Accepted keys are : 'prefix', 'proxy', 'debug' => see correspondant property to get more informations

Parameters
stringURI for the XML-RPC server
array(optional) Associative array of options

Reimplemented in XML_RPC2_Backend_Php_Client, and XML_RPC2_Backend_Xmlrpcext_Client.

Definition at line 153 of file Client.php.

References $uri, and testMethodName___().

{
if (!$uriParse = parse_url($uri)) {
throw new XML_RPC2_InvalidUriException(sprintf('Client URI \'%s\' is not valid', $uri));
}
$this->uri = $uri;
if (isset($options['prefix'])) {
if (!($this->testMethodName___($options['prefix']))) {
throw new XML_RPC2_InvalidPrefixException(sprintf('Prefix \'%s\' is not valid', $options['prefix']));
}
$this->prefix = $options['prefix'];
}
if (isset($options['proxy'])) {
if (!$proxyParse = parse_url($options['proxy'])) {
throw new XML_RPC2_InvalidProxyException(sprintf('Proxy URI \'%s\' is not valid', $options['proxy']));
}
$this->proxy = $options['proxy'];
}
if (isset($options['debug'])) {
if (!(is_bool($options['debug']))) {
throw new XML_RPC2_InvalidDebugException(sprintf('Debug \'%s\' is not valid', $options['debug']));
}
$this->debug = $options['debug'];
}
if (isset($options['encoding'])) {
// TODO : control & exception
$this->encoding = $options['encoding'];
}
if (isset($options['uglyStructHack'])) {
$this->uglyStructHack = $options['uglyStructHack'];
}
if (isset($options['sslverify'])) {
if (!(is_bool($options['sslverify']))) {
throw new XML_RPC2_InvalidSslverifyException(sprintf('SSL verify \'%s\' is not valid', $options['sslverify']));
}
$this->sslverify = $options['sslverify'];
}
}

+ Here is the call graph for this function:

Member Function Documentation

XML_RPC2_Client::__call (   $methodName,
  $parameters 
)

__call Catchall.

This method catches remote method calls and provides for remote forwarding.

If the parameters are native types, this method will use XML_RPC_Value::createFromNative to convert it into an XML-RPC type. Whenever a parameter is already an instance of XML_RPC_Value it will be used as provided. It follows that, in situations when XML_RPC_Value::createFromNative proves inacurate – as when encoding DateTime values – you should present an instance of XML_RPC_Value in lieu of the native parameter.

Parameters
stringMethod name
arrayParameters
Returns
mixed The call result, already decoded into native types

Definition at line 230 of file Client.php.

{
$args = array($methodName, $parameters);
return @call_user_func_array(array($this, 'remoteCall___'), $args);
}
static XML_RPC2_Client::create (   $uri,
  $options = array() 
)
static

Factory method to select, create and return a XML_RPC2_Client backend.

To create a new XML_RPC2_Client, a URI must be provided (e.g. http://xmlrpc.example.com/1.0/).

Optionally, some options may be set.

Parameters
stringURI for the XML-RPC server
array(optional) associative array of options (see constructor)

Definition at line 205 of file Client.php.

References $uri, XML_RPC2_Backend\getClientClassname(), and XML_RPC2_Backend\setBackend().

Referenced by ilRpcClientFactory\factory().

{
if (isset($options['backend'])) {
XML_RPC2_Backend::setBackend($options['backend']);
}
return new $backend($uri, $options);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

XML_RPC2_Client::displayDebugInformations2___ (   $result)
protected

Display debug informations (part 2)

NB : The '___' at the end of the method name is to avoid collisions with XMLRPC __call()

Parameters
mixed$resultdecoded server response

Definition at line 270 of file Client.php.

References $result.

Referenced by XML_RPC2_Backend_Xmlrpcext_Client\remoteCall___(), and XML_RPC2_Backend_Php_Client\remoteCall___().

{
print "***** Decoded result *****\n";
print_r($result);
print "\n***** End of decoded result *****";
print '</pre>';
}

+ Here is the caller graph for this function:

XML_RPC2_Client::displayDebugInformations___ (   $request,
  $body 
)
protected

Display debug informations.

NB : The '___' at the end of the method name is to avoid collisions with XMLRPC __call()

Parameters
string$requestXML client request
string$bodyXML server response

Definition at line 248 of file Client.php.

Referenced by XML_RPC2_Backend_Xmlrpcext_Client\remoteCall___(), and XML_RPC2_Backend_Php_Client\remoteCall___().

{
print '<pre>';
print "***** Request *****\n";
print htmlspecialchars($request);
print "***** End Of request *****\n\n";
print "***** Server response *****\n";
print htmlspecialchars($body);
print "\n***** End of server response *****\n\n";
}

+ Here is the caller graph for this function:

XML_RPC2_Client::remoteCall___ (   $methodName,
  $parameters 
)
abstract

remoteCall executes the XML-RPC call, and returns the result

NB : The '___' at the end of the method name is to avoid collisions with XMLRPC __call()

Parameters
stringMethod name
arrayParameters

Reimplemented in XML_RPC2_Backend_Php_Client, and XML_RPC2_Backend_Xmlrpcext_Client.

XML_RPC2_Client::testMethodName___ (   $methodName)
protected

Return true is the given method name is ok with XML/RPC spec.

NB : The '___' at the end of the method name is to avoid collisions with XMLRPC __call()

Parameters
string$methodNamemethod name
Returns
boolean true if ok

Definition at line 290 of file Client.php.

Referenced by __construct().

{
return (preg_match('~^[a-zA-Z0-9_.:/]*$~', $methodName));
}

+ Here is the caller graph for this function:

Field Documentation

XML_RPC2_Client::$debug = false
protected

Definition at line 103 of file Client.php.

XML_RPC2_Client::$encoding = 'iso-8859-1'
protected

Definition at line 110 of file Client.php.

XML_RPC2_Client::$prefix = null
protected

Definition at line 96 of file Client.php.

XML_RPC2_Client::$proxy = null
protected

Definition at line 89 of file Client.php.

XML_RPC2_Client::$sslverify = true
protected

Definition at line 117 of file Client.php.

XML_RPC2_Client::$uglyStructHack = true
protected

ugly hack flag to avoid http://bugs.php.net/bug.php?id=21949

see XML_RPC2_Backend_Xmlrpcext_Value::createFromNative() from more infos

Definition at line 127 of file Client.php.

const XML_RPC2_Client::VERSION = '1.0.4'

Definition at line 74 of file Client.php.

Referenced by XML_RPC2_Util_HTTPRequest\sendRequest().


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