示例#1
0
 /**
  * Do request proxy method.
  *
  * @param  CommonClient $client   Actual SOAP client.
  * @param  string       $request  The request body.
  * @param  string       $location The SOAP URI.
  * @param  string       $action   The SOAP action to call.
  * @param  integer      $version  The SOAP version to use.
  * @param  integer      $one_way  (Optional) The number 1 if a response is not expected.
  * @return string The XML SOAP response.
  */
 public function _doRequest(CommonClient $client, $request, $location, $action, $version, $one_way = null)
 {
     if (!$this->useNtlm) {
         return parent::_doRequest($client, $request, $location, $action, $version, $one_way);
     }
     $curlClient = $this->getCurlClient();
     $headers = array('Content-Type' => 'text/xml; charset=utf-8', 'Method' => 'POST', 'SOAPAction' => '"' . $action . '"', 'User-Agent' => 'PHP-SOAP-CURL');
     $uri = new HttpUri($location);
     $curlClient->setCurlOption(CURLOPT_HTTPAUTH, CURLAUTH_NTLM)->setCurlOption(CURLOPT_SSL_VERIFYHOST, false)->setCurlOption(CURLOPT_SSL_VERIFYPEER, false)->setCurlOption(CURLOPT_USERPWD, $this->options['login'] . ':' . $this->options['password']);
     // Perform the cURL request and get the response
     $curlClient->connect($uri->getHost(), $uri->getPort());
     $curlClient->write('POST', $uri, 1.1, $headers, $request);
     $response = HttpResponse::fromString($curlClient->read());
     $curlClient->close();
     // Save headers
     $this->lastRequestHeaders = $this->flattenHeaders($headers);
     $this->lastResponseHeaders = $response->getHeaders()->toString();
     // Return only the XML body
     return $response->getBody();
 }