3 declare(strict_types=1);
33 $this->log = $DIC->logger()->wsrv();
35 $this->use_wsdl =
true;
36 $timeout = (
int) $this->
settings->get(
'soap_connect_timeout', (
string) self::DEFAULT_CONNECT_TIMEOUT);
38 $this->connect_timeout = $timeout;
40 $this->connect_timeout = $timeout;
42 $this->response_timeout = (
int) $this->
settings->get(
'soap_response_timeout', (
string) self::DEFAULT_RESPONSE_TIMEOUT);
52 $this->connect_timeout = $a_timeout;
62 $this->response_timeout = $a_timeout;
72 $this->use_wsdl = $a_stat;
80 public function init(): bool
82 $internal_path = $this->
settings->get(
'soap_internal_wsdl_path');
85 $this->uri = $internal_path;
86 } elseif (trim($this->
settings->get(
'soap_wsdl_path',
'')) !==
'') {
87 $this->uri = $this->
settings->get(
'soap_wsdl_path',
'');
93 $this->log->debug(
'Using wsdl: ' . $this->
getServer());
94 $this->log->debug(
'Using connection timeout: ' . $this->
getTimeout());
98 $this->
client =
new SoapClient(
101 'exceptions' =>
true,
104 'stream_context' => $this->uri === $internal_path ? stream_context_create([
106 'verify_peer' => (
bool) $this->
settings->get(
'soap_internal_wsdl_verify_peer',
'1'),
107 'verify_peer_name' => (bool) $this->
settings->get(
'soap_internal_wsdl_verify_peer_name',
'1'),
108 'allow_self_signed' => (bool) $this->
settings->get(
'soap_internal_wsdl_allow_self_signed',
''),
115 $this->log->warning(
'Soap init failed with message: ' . $ex->getMessage());
125 $this->stored_socket_timeout = (
int) ini_get(
'default_socket_timeout');
126 $this->log->debug(
'Default socket timeout is: ' . $this->stored_socket_timeout);
129 $this->log->debug(
'WSDL mode, using socket timeout: ' . $this->
getTimeout());
130 ini_set(
'default_socket_timeout', (
string) $this->
getTimeout());
132 $this->log->debug(
'Non WSDL mode, using socket timeout: ' . $this->
getResponseTimeout());
144 ini_set(
'default_socket_timeout', (
string) $this->stored_socket_timeout);
145 $this->log->debug(
'Restoring default socket timeout to: ' . $this->stored_socket_timeout);
154 public function call(
string $a_operation, array $a_params)
156 $this->log->debug(
'Calling webservice: ' . $a_operation);
160 return $this->
client->__call($a_operation, $a_params);
162 $this->log->error(
'Calling webservice failed with message: ' . $exception->getMessage());
163 $this->log->debug((
string) $this->
client->__getLastResponseHeaders());
164 $this->log->debug((
string) $this->
client->__getLastResponse());
167 $this->log->error(
'Caught unknown exception with message: ' . $exception->getMessage());
168 $this->log->debug((
string) $this->
client->__getLastResponseHeaders());
169 $this->log->debug((
string) $this->
client->__getLastResponse());
resetSocketTimeout()
Reset socket default timeout to defaults.
const DEFAULT_RESPONSE_TIMEOUT
const DEFAULT_CONNECT_TIMEOUT
setResponseTimeout(int $a_timeout)
int $stored_socket_timeout
setTimeout(int $a_timeout)
call(string $a_operation, array $a_params)
__construct(string $a_uri='')
setSocketTimeout(bool $a_wsdl_mode)
client()
description: > This example shows how a Progress Bar can be rendered and used on the client...