diff --git a/src/Requests/SoapRequest.php b/src/Requests/SoapRequest.php index 89964cb..edafb01 100644 --- a/src/Requests/SoapRequest.php +++ b/src/Requests/SoapRequest.php @@ -25,8 +25,8 @@ public function request(string $method, array $requestBody, bool $convertToSoap $response = $this->soapClient->$method($convertToSoap ? $this->arrayToSoapVar($requestBody) : $requestBody); RequestEvent::dispatch( - property_exists($this->soapClient, '__last_request') ? $this->soapClient->__last_request : '', - property_exists($this->soapClient, '__last_response') ? $this->soapClient->__last_response : '', + $this->soapClient->__getLastRequest() ?? '', + $this->soapClient->__getLastResponse() ?? '', true ); @@ -34,8 +34,8 @@ public function request(string $method, array $requestBody, bool $convertToSoap Log::info( 'SOAP REQUEST SUCCESS:'. "\nSOAP method: ".$method. - property_exists($this->soapClient, '__last_request') - ? "\nSOAP request start***".$this->soapClient->__last_request.'***SOAP request end' + $this->soapClient->__getLastRequest() + ? "\nSOAP request start***".$this->soapClient->__getLastRequest().'***SOAP request end' : '' ); } @@ -43,8 +43,8 @@ public function request(string $method, array $requestBody, bool $convertToSoap return $response; } catch (\Exception $exception) { RequestEvent::dispatch( - property_exists($this->soapClient, '__last_request') ? $this->soapClient->__last_request : '', - property_exists($this->soapClient, '__last_response') ? $this->soapClient->__last_response : '', + $this->soapClient->__getLastRequest() ?? '', + $this->soapClient->__getLastResponse() ?? '', false ); @@ -71,16 +71,16 @@ public function request(string $method, array $requestBody, bool $convertToSoap } $message = "SOAP REQUEST FAILED:\nMessage: ".$exception->getMessage(). - "\nSOAP method: ".$method. - ( - property_exists($this->soapClient, '__last_request') - ? "\nSOAP request start***".$this->soapClient->__last_request.'***SOAP request end' - : '' - ).( - property_exists($this->soapClient, '__last_response') - ? "\nSOAP response start***: ".$this->soapClient->__last_response.'***SOAP response end' - : '' - ); + "\nSOAP method: ".$method. + ( + $this->soapClient->__getLastRequest() + ? "\nSOAP request start***".$this->soapClient->__getLastRequest().'***SOAP request end' + : '' + ).( + $this->soapClient->__getLastResponse() + ? "\nSOAP response start***: ".$this->soapClient->__getLastResponse().'***SOAP response end' + : '' + ); // "\nTrace: ".json_encode($exception->getTrace()); Log::error($message); diff --git a/src/Traits/Soap/SoapVmApis.php b/src/Traits/Soap/SoapVmApis.php index 670fc5e..28d1faf 100644 --- a/src/Traits/Soap/SoapVmApis.php +++ b/src/Traits/Soap/SoapVmApis.php @@ -30,8 +30,8 @@ public function getObjectInfo(string $objectId, string $objectType, string $path } catch (\Exception $exception) { Log::error( "SOAP REQUEST FAILED:\nMessage: ".$exception->getMessage(). - "\nSOAP request: ".$this->soapClient->__last_request. - "\nSOAP response: ".$this->soapClient->__last_response ?? '' + "\nSOAP request: ".($this->soapClient->__getLastRequest() ?? ''). + "\nSOAP response: ".($this->soapClient->__getLastResponse() ?? '') ); if (array_keys(json_decode(json_encode($exception->detail), true))[0] === 'ManagedObjectNotFoundFault') { diff --git a/src/VmWareClientInit.php b/src/VmWareClientInit.php index ca216b0..3967a89 100755 --- a/src/VmWareClientInit.php +++ b/src/VmWareClientInit.php @@ -177,10 +177,10 @@ private function createSoapSession(): void ]; $this->soapClient->Login($loginMessage); - if (isset($this->soapClient->_cookies)) { - $soapSessionToken = $this->soapClient->_cookies['vmware_soap_session'][0]; + if (array_key_exists('vmware_soap_session', $this->soapClient->__getCookies())) { + $soapSessionToken = $this->soapClient->__getCookies()['vmware_soap_session'][0]; } else { - $responseHeaders = $this->soapClient->__last_response_headers; + $responseHeaders = $this->soapClient->__getLastResponseHeaders(); $string = strstr($responseHeaders, 'vmware_soap_session'); $string = strstr($string, '"');