예제 #1
0
 /**
  * @param string $request
  * @param string $location
  * @param string $action
  * @param integer $version
  * @param int $one_way
  *
  * @throws \VCR\VCRException It this method is called although VCR is disabled.
  *
  * @return string SOAP response.
  */
 public function doRequest($request, $location, $action, $version, $one_way = 0)
 {
     if ($this->status === self::DISABLED) {
         throw new VCRException('Hook must be enabled.', VCRException::LIBRARY_HOOK_DISABLED);
     }
     $vcrRequest = new Request('POST', $location);
     $contentType = $version == SOAP_1_2 ? 'application/soap+xml' : 'text/xml';
     $vcrRequest->addHeader('Content-Type', $contentType . '; charset=utf-8; action="' . $action . '"');
     $vcrRequest->setBody($request);
     $requestCallback = self::$requestCallback;
     $response = $requestCallback($vcrRequest);
     return (string) $response->getBody(true);
 }