2 include_once
'./Services/WebServices/RPC/classes/class.ilRpcClientException.php';
49 function __construct ($a_url, $a_prefix =
'', $a_timeout = 0, $a_encoding =
'utf-8')
51 if(!extension_loaded(
'xmlrpc'))
57 $this->url = (
string) $a_url;
58 $this->prefix = (
string) $a_prefix;
59 $this->timeout = (int) $a_timeout;
60 $this->encoding = (
string) $a_encoding;
71 public function __call($a_method, $a_params)
74 $method_name = str_replace(
'_',
'.', $this->prefix . $a_method);
76 'verbosity'=>
'newlines_only',
77 'escaping' =>
'markup' 85 $post_data = xmlrpc_encode_request($method_name, $a_params,$rpc_options);
90 include_once
'./Services/WebServices/Curl/classes/class.ilCurlConnection.php';
93 $curl->setOpt(CURLOPT_HEADER,
'Content-Type: text/xml');
94 $curl->setOpt(CURLOPT_POST,
sizeof($post_data));
95 $curl->setOpt(CURLOPT_POSTFIELDS, $post_data);
96 $curl->setOpt(CURLOPT_RETURNTRANSFER , 1);
98 if($this->timeout > 0)
100 $curl->setOpt(CURLOPT_TIMEOUT, $this->timeout);
103 $xml_resp = $curl->exec();
107 ilLoggerFactory::getLogger(
'wsrv')->error(
'RpcClient could not connect to ' . $this->url .
' Reason ' . $e->getCode() .
': ' .$e->getMessage());
112 $resp = xmlrpc_decode($xml_resp,$this->encoding);
115 if(is_array($resp)&& xmlrpc_is_fault($resp))
118 include_once
'./Services/WebServices/RPC/classes/class.ilRpcClientException.php';
119 throw new ilRpcClientException(
'RPC-Server returned fault message: '.$resp[
'faultString'], $resp[
'faultCode']);
Add rich text string
The name of the decorator.
Create styles array
The data for the language used.
Class ilRpcClientException.
__call($a_method, $a_params)
Magic caller to all RPC functions.
__construct($a_url, $a_prefix='', $a_timeout=0, $a_encoding='utf-8')
ilRpcClient constructor.
static getLogger($a_component_id)
Get component logger.