/** * Wait for the request termination and return its result. * * @return mixed */ public function getResult() { if ($this->_isSynchronized) { return $this->_result; } $this->_isSynchronized = true; // Wait for a result. $response = self::$_curl->getResult($this->_handler); try { if ($response['result_timeout'] == 'data') { // Data timeout. throw new \SoapFault("HTTP", "Response is timed out"); } if ($response['result_timeout'] == 'connect') { // Native SoapClient compatible message. throw new \SoapFault("HTTP", "Could not connect to host"); } if (!strlen($response['body'])) { // Empty body (case of DNS error etc.). throw new \SoapFault("HTTP", "SOAP response is empty"); } // Process cookies. foreach ($this->_extractCookies($response['headers']) as $k => $v) { if ($this->_isCookieValid($v)) { $this->_client->__setCookie($k, $v); } } // Run the SOAP handler. $this->_result = $this->_client->__soapCallForced($response['body'], $this->_callArgs); } catch (\Exception $e) { // Add more debug parameters to SoapFault. $e->location = $this->_request['location']; $e->request = $this->_callArgs; $e->response = $response; throw $e; } return $this->_result; }