| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- <?php
- namespace ModulesGarden\Servers\ZimbraEmail\App\Libs\Zimbra\Components\Api\Soap;
- use SoapClient;
- /**
- *
- * Created by PhpStorm.
- * User: Tomasz Bielecki ( tomasz.bi@modulesgarden.com )
- * Date: 27.08.19
- * Time: 15:47
- * Class MySoapClient
- */
- class MySoapClient extends SoapClient
- {
- /**
- * @param string $request
- * @param string $location
- * @param string $action
- * @param int $version
- * @return string
- */
- public function __doRequest($request, $location, $action, $version)
- {
- if(stripos($request, 'DistributionListActionRequest') !== false)
- {
- $request = str_replace(array('ns1:DistributionListActionRequest', 'xmlns:ns2="urn:zimbra"'), array('ns2:DistributionListActionRequest', 'xmlns:ns2="urn:zimbraAccount"'), $request);
- }
- logModuleCall(
- 'zimbraEmail',
- __FUNCTION__,
- [
- $request,
- $location,
- $action,
- $version
- ],
- "Debug: request, location, action, version",
- time()
- );
- $exception = null;
- try {
-
- $response = parent::__doRequest($request, $location, $action, $version);
-
- }
-
- catch (SoapFault $sf) {
-
- //this code was not reached
-
- $exception = $sf;
-
- }
-
- catch (Exception $e) {
-
- //nor was this code reached either
-
- $exception = $e;
-
- }
-
- if((isset($this->__soap_fault)) && ($this->__soap_fault != null)) {
-
- //this is where the exception from __doRequest is stored
-
- $exception = $this->__soap_fault;
-
- }
-
- logModuleCall(
- 'zimbraEmail',
- __FUNCTION__,
- $exception,
- "Debug: response",
- time()
- );
- return $response;
- }
- /**
- * @param string $function_name
- * @param array $arguments
- * @param array|null $options
- * @param null $input_headers
- * @param array|null $output_headers
- * @return mixed|void
- */
- public function __soapCall($function_name, array $arguments, array $options = null, $input_headers = null, array &$output_headers = null)
- {
- logModuleCall(
- 'zimbraEmail',
- __FUNCTION__,
- [
- $function_name,
- $arguments,
- $options,
- $input_headers,
- $output_headers
- ],
- "Debug: function_name, arguments, options, input_headers, output_headers",
- time()
- );
- $response = parent::__soapCall($function_name, $arguments, $options, $input_headers, $output_headers);
- logModuleCall(
- 'zimbraEmail',
- __FUNCTION__,
- $response,
- "Debug: function_name, arguments, options, input_headers, output_headers",
- time()
- );
- return $response;
- }
- }
|