blob: 0aafd4af56778021627ba5407ae45d8884f0dad2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
<?
# Lifter002: TODO
# Lifter010: TODO
/**
* Adapter for using php5 ext:soap with Ilias3Soap
*
*
* @author Andre Noack <noack@data-quest.de>
* @access public
* @package ELearning-Interface
*/
class StudipSoapClient
{
var $soap_client;
var $error;
function __construct($path)
{
try {
$this->soap_client = new SoapClient($path, ['trace' => 0]);
} catch (SoapFault $fault) {
$this->error = "Soap Constructor Error " . $fault->faultcode . ": ".$fault->faultstring;
}
}
function _call($method, $params)
{
$result = false;
if ($this->soap_client instanceOf SoapClient) {
$this->faultstring = "";
try {
$result = $this->soap_client->__soapCall($method, $params);
} catch (SoapFault $fault) {
$this->faultstring = $fault->faultstring;
if (!in_array(mb_strtolower($this->faultstring), ["session not valid","session invalid", "session idled"])) {
unset($params['password']);
$this->error .= sprintf(_("SOAP-Fehler, Funktion \"%s\":"), $method) . " " . $fault->faultstring . " (" . $fault->faultcode . ")".print_r($params,1);
error_log($this->error);
}
$this->soap_client->fault = true;
return false;
}
if (is_object($result)) $result = (array)$result;
if (is_array($result)){
foreach($result as $index => $one){
if (is_object($one)) $result[$index] = (array)$one;
}
}
$this->soap_client->fault = false;
}
return $result;
}
function getError()
{
$error = $this->error;
$this->error = "";
if ($error != "")
return $error;
else
return false;
}
}
|