Esempio n. 1
0
 /**
  * Execute SOAP request using CURL
  *
  * @param string $request
  * @param string $location
  * @param string $action
  * @param int $version
  * @param int $one_way
  * @return string
  * @throws \Exception
  */
 public function __doRequest($request, $location, $action, $version, $one_way = 0)
 {
     $this->curlPlusClient->initialize($location, true);
     $this->curlPlusClient->setCurlOpt(CURLOPT_POSTFIELDS, (string) $request);
     $this->curlPlusClient->setCurlOpts($this->curlOptArray);
     // Add the header strings
     foreach ($this->requestHeaders as $k => $v) {
         $this->getCurlClient()->setRequestHeader($k, $v);
     }
     $this->curlPlusClient->setRequestHeader('SOAPAction', $action);
     $ret = $this->curlPlusClient->execute();
     if ($this->debugEnabled()) {
         $this->_debugQueries[] = array('headers' => $ret->getRequestHeaderArray(), 'body' => (string) $request);
         $this->_debugResults[] = $ret;
     }
     if ($ret->responseBody == false || $ret->httpCode !== 200) {
         throw new \Exception('DCarbone\\SoapClientPlus::__doRequest - CURL Error during call: "' . addslashes($ret->curlError) . '", "' . addslashes($ret->responseBody) . '"');
     }
     return $ret->responseBody;
 }