3declare(strict_types=1);
33 $this->log =
$DIC->logger()->wsrv();
35 $this->use_wsdl =
true;
38 $this->connect_timeout = $timeout;
40 $this->connect_timeout = $timeout;
52 $this->connect_timeout = $a_timeout;
62 $this->response_timeout = $a_timeout;
72 $this->use_wsdl = $a_stat;
80 public function init(): bool
83 if (trim($this->
settings->get(
'soap_wsdl_path',
'')) !==
'') {
84 $this->uri = $this->
settings->get(
'soap_wsdl_path',
'');
90 $this->log->debug(
'Using wsdl: ' . $this->
getServer());
91 $this->log->debug(
'Using connection timeout: ' . $this->
getTimeout());
95 $this->client =
new SoapClient(
104 }
catch (SoapFault $ex) {
105 $this->log->warning(
'Soap init failed with message: ' . $ex->getMessage());
115 $this->stored_socket_timeout = (
int) ini_get(
'default_socket_timeout');
116 $this->log->debug(
'Default socket timeout is: ' . $this->stored_socket_timeout);
119 $this->log->debug(
'WSDL mode, using socket timeout: ' . $this->
getTimeout());
120 ini_set(
'default_socket_timeout', (
string) $this->
getTimeout());
122 $this->log->debug(
'Non WSDL mode, using socket timeout: ' . $this->
getResponseTimeout());
134 ini_set(
'default_socket_timeout', (
string) $this->stored_socket_timeout);
135 $this->log->debug(
'Restoring default socket timeout to: ' . $this->stored_socket_timeout);
144 public function call(
string $a_operation, array $a_params)
146 $this->log->debug(
'Calling webservice: ' . $a_operation);
150 return $this->client->__call($a_operation, $a_params);
151 }
catch (SoapFault $exception) {
152 $this->log->error(
'Calling webservice failed with message: ' . $exception->getMessage());
153 $this->log->debug((
string) $this->client->__getLastResponseHeaders());
154 $this->log->debug((
string) $this->client->__getLastResponse());
156 }
catch (Exception $exception) {
157 $this->log->error(
'Caught unknown exception with message: ' . $exception->getMessage());
158 $this->log->debug((
string) $this->client->__getLastResponseHeaders());
159 $this->log->debug((
string) $this->client->__getLastResponse());
Component logger with individual log levels by component id.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
call(string $a_operation, array $a_params)
setSocketTimeout(bool $a_wsdl_mode)
int $stored_socket_timeout
setTimeout(int $a_timeout)
const DEFAULT_CONNECT_TIMEOUT
setResponseTimeout(int $a_timeout)
resetSocketTimeout()
Reset socket default timeout to defaults.
__construct(string $a_uri='')
const DEFAULT_RESPONSE_TIMEOUT