ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules 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 More...
 
 __call ($methodName, $parameters)
 __call Catchall. More...
 

Static Public Member Functions

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

Data Fields

const VERSION = '1.0.4'
 

Protected Member Functions

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

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 More...
 

Detailed Description

Definition at line 72 of file Client.php.

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 153 of file Client.php.

References $options, $uri, and testMethodName___().

154  {
155  if (!$uriParse = parse_url($uri)) {
156  throw new XML_RPC2_InvalidUriException(sprintf('Client URI \'%s\' is not valid', $uri));
157  }
158  $this->uri = $uri;
159  if (isset($options['prefix'])) {
160  if (!($this->testMethodName___($options['prefix']))) {
161  throw new XML_RPC2_InvalidPrefixException(sprintf('Prefix \'%s\' is not valid', $options['prefix']));
162  }
163  $this->prefix = $options['prefix'];
164  }
165  if (isset($options['proxy'])) {
166  if (!$proxyParse = parse_url($options['proxy'])) {
167  throw new XML_RPC2_InvalidProxyException(sprintf('Proxy URI \'%s\' is not valid', $options['proxy']));
168  }
169  $this->proxy = $options['proxy'];
170  }
171  if (isset($options['debug'])) {
172  if (!(is_bool($options['debug']))) {
173  throw new XML_RPC2_InvalidDebugException(sprintf('Debug \'%s\' is not valid', $options['debug']));
174  }
175  $this->debug = $options['debug'];
176  }
177  if (isset($options['encoding'])) {
178  // TODO : control & exception
179  $this->encoding = $options['encoding'];
180  }
181  if (isset($options['uglyStructHack'])) {
182  $this->uglyStructHack = $options['uglyStructHack'];
183  }
184  if (isset($options['sslverify'])) {
185  if (!(is_bool($options['sslverify']))) {
186  throw new XML_RPC2_InvalidSslverifyException(sprintf('SSL verify \'%s\' is not valid', $options['sslverify']));
187  }
188  $this->sslverify = $options['sslverify'];
189  }
190  }
if(!is_array($argv)) $options
testMethodName___($methodName)
Return true is the given method name is ok with XML/RPC spec.
Definition: Client.php:290
+ Here is the call graph for this function:

Member Function Documentation

◆ __call()

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.

231  {
232  $args = array($methodName, $parameters);
233  return @call_user_func_array(array($this, 'remoteCall___'), $args);
234  }

◆ create()

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 $options, $uri, XML_RPC2_Backend\getClientClassname(), and XML_RPC2_Backend\setBackend().

Referenced by XML_RPC2_CachedClient\_workWithoutCache___(), and ilRpcClientFactory\factory().

206  {
207  if (isset($options['backend'])) {
209  }
211  return new $backend($uri, $options);
212  }
static setBackend($backend)
Backend setter.
Definition: Backend.php:98
static getClientClassname()
Include the relevant php files for the client class, and return the backend client class name...
Definition: Backend.php:171
if(!is_array($argv)) $options
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ displayDebugInformations2___()

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___().

271  {
272  print "***** Decoded result *****\n";
273  print_r($result);
274  print "\n***** End of decoded result *****";
275  print '</pre>';
276  }
$result
+ Here is the caller graph for this function:

◆ displayDebugInformations___()

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___().

249  {
250  print '<pre>';
251  print "***** Request *****\n";
252  print htmlspecialchars($request);
253  print "***** End Of request *****\n\n";
254  print "***** Server response *****\n";
255  print htmlspecialchars($body);
256  print "\n***** End of server response *****\n\n";
257  }
+ Here is the caller graph for this function:

◆ remoteCall___()

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

◆ testMethodName___()

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().

291  {
292  return (preg_match('~^[a-zA-Z0-9_.:/]*$~', $methodName));
293  }
+ Here is the caller graph for this function:

Field Documentation

◆ $debug

XML_RPC2_Client::$debug = false
protected

Definition at line 103 of file Client.php.

◆ $encoding

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

Definition at line 110 of file Client.php.

◆ $prefix

XML_RPC2_Client::$prefix = null
protected

Definition at line 96 of file Client.php.

◆ $proxy

XML_RPC2_Client::$proxy = null
protected

Definition at line 89 of file Client.php.

◆ $sslverify

XML_RPC2_Client::$sslverify = true
protected

Definition at line 117 of file Client.php.

◆ $uglyStructHack

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.

◆ $uri

◆ VERSION

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: