2011-09-26 22:42:21 +02:00
|
|
|
<?php
|
2011-10-03 21:03:46 +02:00
|
|
|
|
|
|
|
/*
|
2011-09-26 22:42:21 +02:00
|
|
|
* This file is part of the BeSimpleSoapClient.
|
|
|
|
*
|
|
|
|
* (c) Christian Kerl <christian-kerl@web.de>
|
|
|
|
* (c) Francis Besset <francis.besset@gmail.com>
|
|
|
|
*
|
|
|
|
* This source file is subject to the MIT license that is bundled
|
|
|
|
* with this source code in the file LICENSE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace BeSimple\SoapClient;
|
|
|
|
|
2017-02-03 15:22:37 +01:00
|
|
|
use BeSimple\SoapBundle\Soap\SoapAttachment;
|
|
|
|
use BeSimple\SoapBundle\Soap\SoapAttachmentList;
|
|
|
|
use BeSimple\SoapClient\Curl\Curl;
|
|
|
|
use BeSimple\SoapClient\Curl\CurlOptionsBuilder;
|
|
|
|
use BeSimple\SoapClient\Curl\CurlResponse;
|
|
|
|
use BeSimple\SoapClient\SoapOptions\SoapClientOptions;
|
|
|
|
use BeSimple\SoapCommon\Fault\SoapFaultEnum;
|
2017-05-26 10:53:41 +02:00
|
|
|
use BeSimple\SoapCommon\Fault\SoapFaultParser;
|
2017-04-04 18:36:18 +02:00
|
|
|
use BeSimple\SoapCommon\Fault\SoapFaultPrefixEnum;
|
|
|
|
use BeSimple\SoapCommon\Fault\SoapFaultSourceGetter;
|
2017-02-03 15:22:37 +01:00
|
|
|
use BeSimple\SoapCommon\Mime\PartFactory;
|
2016-11-08 15:42:52 +01:00
|
|
|
use BeSimple\SoapCommon\SoapKernel;
|
2016-10-27 16:24:44 +02:00
|
|
|
use BeSimple\SoapCommon\SoapOptions\SoapOptions;
|
|
|
|
use BeSimple\SoapCommon\SoapRequest;
|
2016-11-01 16:23:21 +01:00
|
|
|
use BeSimple\SoapCommon\SoapRequestFactory;
|
2017-02-03 15:22:37 +01:00
|
|
|
use Exception;
|
|
|
|
use SoapFault;
|
2011-12-11 21:20:35 +01:00
|
|
|
|
2011-09-26 22:42:21 +02:00
|
|
|
/**
|
2011-10-02 12:23:59 +02:00
|
|
|
* Extended SoapClient that uses a a cURL wrapper for all underlying HTTP
|
|
|
|
* requests in order to use proper authentication for all requests. This also
|
|
|
|
* adds NTLM support. A custom WSDL downloader resolves remote xsd:includes and
|
2011-09-26 22:42:21 +02:00
|
|
|
* allows caching of all remote referenced items.
|
|
|
|
*
|
2011-10-22 11:28:15 +02:00
|
|
|
* @author Andreas Schamberger <mail@andreass.net>
|
2017-02-03 15:22:37 +01:00
|
|
|
* @author Petr Bechyně <mail@petrbechyne.com>
|
2011-09-26 22:42:21 +02:00
|
|
|
*/
|
|
|
|
class SoapClient extends \SoapClient
|
|
|
|
{
|
2017-05-26 10:53:41 +02:00
|
|
|
use SoapClientNativeMethodsTrait;
|
|
|
|
|
2017-04-04 18:36:18 +02:00
|
|
|
/** @var SoapOptions */
|
2016-11-08 15:42:52 +01:00
|
|
|
protected $soapOptions;
|
2017-04-04 18:36:18 +02:00
|
|
|
/** @var Curl */
|
2017-02-03 15:22:37 +01:00
|
|
|
private $curl;
|
2011-11-02 12:48:51 +01:00
|
|
|
|
2017-02-03 15:22:37 +01:00
|
|
|
public function __construct(SoapClientOptions $soapClientOptions, SoapOptions $soapOptions)
|
|
|
|
{
|
|
|
|
$this->soapClientOptions = $soapClientOptions;
|
|
|
|
$this->soapOptions = $soapOptions;
|
|
|
|
$this->curl = new Curl(
|
|
|
|
CurlOptionsBuilder::buildForSoapClient($soapClientOptions)
|
|
|
|
);
|
2011-10-16 19:49:24 +02:00
|
|
|
|
2017-02-03 15:22:37 +01:00
|
|
|
try {
|
2017-02-17 00:14:05 +01:00
|
|
|
$wsdlPath = $this->loadWsdl(
|
|
|
|
$this->curl,
|
|
|
|
$soapOptions->getWsdlFile(),
|
2017-02-17 03:19:22 +01:00
|
|
|
$soapOptions->getWsdlCacheType(),
|
2017-07-21 10:21:32 +02:00
|
|
|
$soapClientOptions->isResolveRemoteIncludes()
|
2017-02-03 15:22:37 +01:00
|
|
|
);
|
|
|
|
} catch (Exception $e) {
|
|
|
|
throw new SoapFault(
|
|
|
|
SoapFaultEnum::SOAP_FAULT_SOAP_CLIENT_ERROR,
|
2017-02-17 00:14:05 +01:00
|
|
|
'Unable to load WsdlPath ('.$soapOptions->getWsdlFile().') with message: '.$e->getMessage().' in file: '.$e->getFile().' (line: '.$e->getLine().')'
|
2017-02-03 15:22:37 +01:00
|
|
|
);
|
|
|
|
}
|
2017-02-17 00:14:05 +01:00
|
|
|
|
|
|
|
@parent::__construct($wsdlPath, $soapClientOptions->toArray() + $soapOptions->toArray());
|
2017-02-03 15:22:37 +01:00
|
|
|
}
|
2011-10-16 19:49:24 +02:00
|
|
|
|
2011-09-26 22:42:21 +02:00
|
|
|
/**
|
2017-02-17 00:26:01 +01:00
|
|
|
* @param string $functionName
|
2017-02-03 15:22:37 +01:00
|
|
|
* @param array $arguments
|
|
|
|
* @param array|null $options
|
|
|
|
* @param SoapAttachment[] $soapAttachments
|
|
|
|
* @param null $inputHeaders
|
|
|
|
* @param array|null $outputHeaders
|
|
|
|
* @return SoapResponse
|
2011-09-26 22:42:21 +02:00
|
|
|
*/
|
2017-02-03 15:22:37 +01:00
|
|
|
public function soapCall($functionName, array $arguments, array $soapAttachments = [], array $options = null, $inputHeaders = null, array &$outputHeaders = null)
|
2011-09-26 22:42:21 +02:00
|
|
|
{
|
2017-02-17 03:19:22 +01:00
|
|
|
$this->setSoapAttachmentsOnRequestToStorage($soapAttachments);
|
2017-04-04 18:36:18 +02:00
|
|
|
try {
|
2017-02-17 03:19:22 +01:00
|
|
|
|
2017-04-04 18:36:18 +02:00
|
|
|
$soapResponseAsObject = parent::__soapCall($functionName, $arguments, $options, $inputHeaders, $outputHeaders);
|
|
|
|
$soapResponse = $this->getSoapResponseFromStorage();
|
|
|
|
$soapResponse->setResponseObject($soapResponseAsObject);
|
|
|
|
|
|
|
|
return $soapResponse;
|
|
|
|
|
|
|
|
} catch (SoapFault $soapFault) {
|
|
|
|
if (SoapFaultSourceGetter::isNativeSoapFault($soapFault)) {
|
2017-06-16 13:42:08 +02:00
|
|
|
$soapFault = $this->decorateNativeSoapFaultWithSoapResponseTracingData($soapFault);
|
2017-04-04 18:36:18 +02:00
|
|
|
}
|
2017-02-17 03:19:22 +01:00
|
|
|
|
2017-04-04 18:36:18 +02:00
|
|
|
throw $soapFault;
|
|
|
|
}
|
2016-11-08 15:42:52 +01:00
|
|
|
}
|
|
|
|
|
2017-02-17 03:19:22 +01:00
|
|
|
/**
|
|
|
|
* Custom request method to be able to modify the SOAP messages.
|
|
|
|
* $oneWay parameter is not used at the moment.
|
|
|
|
*
|
|
|
|
* @param mixed $request Request object
|
|
|
|
* @param string $location Location
|
|
|
|
* @param string $action SOAP action
|
|
|
|
* @param int $version SOAP version
|
|
|
|
* @param SoapAttachment[] $soapAttachments SOAP attachments array
|
|
|
|
*
|
|
|
|
* @return SoapResponse
|
|
|
|
*/
|
2017-05-26 10:53:41 +02:00
|
|
|
protected function performSoapRequest($request, $location, $action, $version, array $soapAttachments = [])
|
2017-02-17 03:19:22 +01:00
|
|
|
{
|
|
|
|
$soapRequest = $this->createSoapRequest($location, $action, $version, $request, $soapAttachments);
|
|
|
|
|
|
|
|
return $this->performHttpSoapRequest($soapRequest);
|
|
|
|
}
|
|
|
|
|
2017-06-05 10:50:53 +02:00
|
|
|
protected function getSoapClientOptions()
|
|
|
|
{
|
|
|
|
return $this->soapClientOptions;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getSoapOptions()
|
|
|
|
{
|
|
|
|
return $this->soapOptions;
|
|
|
|
}
|
|
|
|
|
2016-11-08 15:42:52 +01:00
|
|
|
/**
|
2017-02-03 15:22:37 +01:00
|
|
|
* @param string $location Location
|
|
|
|
* @param string $action SOAP action
|
|
|
|
* @param int $version SOAP version
|
|
|
|
* @param string $request SOAP request body
|
|
|
|
* @param SoapAttachment[] $soapAttachments array of SOAP attachments
|
2016-11-08 15:42:52 +01:00
|
|
|
*
|
2017-02-03 15:22:37 +01:00
|
|
|
* @return SoapRequest
|
2016-11-08 15:42:52 +01:00
|
|
|
*/
|
2017-02-03 15:22:37 +01:00
|
|
|
private function createSoapRequest($location, $action, $version, $request, array $soapAttachments = [])
|
2016-11-08 15:42:52 +01:00
|
|
|
{
|
2017-02-03 15:22:37 +01:00
|
|
|
$soapAttachmentList = new SoapAttachmentList($soapAttachments);
|
|
|
|
$soapRequest = SoapRequestFactory::create($location, $action, $version, $request);
|
|
|
|
if (count($soapAttachments) > 0) {
|
|
|
|
if ($this->soapOptions->hasAttachments() === true) {
|
|
|
|
$soapRequest->setAttachments(PartFactory::createAttachmentParts($soapAttachments));
|
|
|
|
$soapRequest = SoapKernel::filterRequest(
|
|
|
|
$soapRequest,
|
|
|
|
$this->getAttachmentFilters(),
|
|
|
|
$this->soapOptions->getAttachmentType()
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
throw new Exception(
|
|
|
|
'Non SWA SoapClient cannot handle SOAP action '.$action.' with attachments: '.implode(', ', $soapAttachmentList->getSoapAttachmentIds())
|
|
|
|
);
|
|
|
|
}
|
2016-11-08 15:42:52 +01:00
|
|
|
}
|
|
|
|
|
2017-02-03 15:22:37 +01:00
|
|
|
return $soapRequest;
|
2016-11-08 15:42:52 +01:00
|
|
|
}
|
2011-11-02 12:48:51 +01:00
|
|
|
|
2011-09-26 22:42:21 +02:00
|
|
|
/**
|
|
|
|
* Perform HTTP request with cURL.
|
|
|
|
*
|
2011-12-17 16:05:25 +01:00
|
|
|
* @param SoapRequest $soapRequest SoapRequest object
|
2011-12-11 21:20:35 +01:00
|
|
|
* @return SoapResponse
|
2017-02-03 15:22:37 +01:00
|
|
|
* @throws SoapFault
|
2011-09-26 22:42:21 +02:00
|
|
|
*/
|
2016-11-08 15:42:52 +01:00
|
|
|
private function performHttpSoapRequest(SoapRequest $soapRequest)
|
2011-09-26 22:42:21 +02:00
|
|
|
{
|
2017-02-03 15:22:37 +01:00
|
|
|
$curlResponse = $this->curl->executeCurlWithCachedSession(
|
2011-12-11 21:20:35 +01:00
|
|
|
$soapRequest->getLocation(),
|
2017-02-03 15:22:37 +01:00
|
|
|
$soapRequest->getContent(),
|
2017-05-26 10:53:41 +02:00
|
|
|
$this->getHttpHeadersBySoapVersion($soapRequest)
|
2017-02-03 15:22:37 +01:00
|
|
|
);
|
|
|
|
$soapResponseTracingData = new SoapResponseTracingData(
|
|
|
|
$curlResponse->getHttpRequestHeaders(),
|
|
|
|
$soapRequest->getContent(),
|
|
|
|
$curlResponse->getResponseHeader(),
|
|
|
|
$curlResponse->getResponseBody()
|
2011-12-17 16:05:25 +01:00
|
|
|
);
|
2011-12-11 21:20:35 +01:00
|
|
|
|
2017-02-03 15:22:37 +01:00
|
|
|
if ($curlResponse->curlStatusSuccess()) {
|
|
|
|
$soapResponse = $this->returnSoapResponseByTracing(
|
|
|
|
$soapRequest,
|
|
|
|
$curlResponse,
|
|
|
|
$soapResponseTracingData
|
|
|
|
);
|
|
|
|
if ($this->soapOptions->hasAttachments()) {
|
2011-09-26 22:42:21 +02:00
|
|
|
|
2017-02-03 15:22:37 +01:00
|
|
|
return SoapKernel::filterResponse(
|
|
|
|
$soapResponse,
|
|
|
|
$this->getAttachmentFilters(),
|
|
|
|
$this->soapOptions->getAttachmentType()
|
|
|
|
);
|
2017-05-26 10:53:41 +02:00
|
|
|
}
|
2014-04-22 22:29:11 +02:00
|
|
|
|
2017-05-26 10:53:41 +02:00
|
|
|
return $soapResponse;
|
|
|
|
|
|
|
|
}
|
|
|
|
if ($curlResponse->curlStatusFailed()) {
|
|
|
|
|
|
|
|
if ($curlResponse->getHttpResponseStatusCode() >= 500) {
|
|
|
|
$soapFault = SoapFaultParser::parseSoapFault(
|
|
|
|
$curlResponse->getResponseBody()
|
|
|
|
);
|
2014-07-01 15:47:46 +02:00
|
|
|
|
2017-05-26 10:53:41 +02:00
|
|
|
return $this->throwSoapFaultByTracing(
|
|
|
|
$soapFault->faultcode,
|
|
|
|
sprintf(
|
|
|
|
'SOAP HTTP call failed: %s with Message: %s and Code: %s',
|
|
|
|
$curlResponse->getCurlErrorMessage(),
|
|
|
|
$soapFault->getMessage(),
|
|
|
|
$soapFault->faultcode
|
|
|
|
),
|
|
|
|
$soapResponseTracingData
|
|
|
|
);
|
2017-02-03 15:22:37 +01:00
|
|
|
}
|
2011-09-26 22:42:21 +02:00
|
|
|
|
2017-02-03 15:22:37 +01:00
|
|
|
return $this->throwSoapFaultByTracing(
|
2017-05-10 09:15:27 +02:00
|
|
|
SoapFaultEnum::SOAP_FAULT_HTTP.'-'.$curlResponse->getHttpResponseStatusCode(),
|
2017-02-03 15:22:37 +01:00
|
|
|
$curlResponse->getCurlErrorMessage(),
|
|
|
|
$soapResponseTracingData
|
|
|
|
);
|
|
|
|
}
|
2017-05-26 10:53:41 +02:00
|
|
|
|
|
|
|
return $this->throwSoapFaultByTracing(
|
|
|
|
SoapFaultEnum::SOAP_FAULT_SOAP_CLIENT_ERROR,
|
|
|
|
'Cannot process curl response with unresolved status: ' . $curlResponse->getCurlStatus(),
|
|
|
|
$soapResponseTracingData
|
|
|
|
);
|
2011-09-26 22:42:21 +02:00
|
|
|
}
|
|
|
|
|
2011-12-11 21:20:35 +01:00
|
|
|
/**
|
2017-02-03 15:22:37 +01:00
|
|
|
* @param Curl $curl
|
|
|
|
* @param string $wsdlPath
|
|
|
|
* @param int $wsdlCacheType
|
2016-11-08 15:42:52 +01:00
|
|
|
* @param bool $resolveRemoteIncludes
|
2011-12-17 16:05:25 +01:00
|
|
|
*
|
2011-09-26 22:42:21 +02:00
|
|
|
* @return string
|
|
|
|
*/
|
2017-02-03 15:22:37 +01:00
|
|
|
private function loadWsdl(Curl $curl, $wsdlPath, $wsdlCacheType, $resolveRemoteIncludes = true)
|
2011-09-26 22:42:21 +02:00
|
|
|
{
|
2017-02-17 00:14:05 +01:00
|
|
|
$wsdlDownloader = new WsdlDownloader();
|
2011-10-02 12:23:59 +02:00
|
|
|
try {
|
2017-02-03 15:22:37 +01:00
|
|
|
$loadedWsdlFilePath = $wsdlDownloader->getWsdlPath($curl, $wsdlPath, $wsdlCacheType, $resolveRemoteIncludes);
|
|
|
|
} catch (Exception $e) {
|
|
|
|
throw new SoapFault(
|
|
|
|
SoapFaultEnum::SOAP_FAULT_WSDL,
|
2017-02-17 00:14:05 +01:00
|
|
|
'Unable to load WsdlPath ('.$wsdlPath.') with message: '.$e->getMessage().' in file: '.$e->getFile().' (line: '.$e->getLine().')'
|
2017-02-03 15:22:37 +01:00
|
|
|
);
|
2011-09-26 22:42:21 +02:00
|
|
|
}
|
2011-12-11 21:20:35 +01:00
|
|
|
|
2017-02-03 15:22:37 +01:00
|
|
|
return $loadedWsdlFilePath;
|
2011-09-26 22:42:21 +02:00
|
|
|
}
|
2016-11-08 15:42:52 +01:00
|
|
|
|
2017-06-16 13:42:08 +02:00
|
|
|
private function getHttpHeadersBySoapVersion(SoapRequest $soapRequest)
|
|
|
|
{
|
|
|
|
if ($soapRequest->getVersion() === SOAP_1_1) {
|
|
|
|
|
|
|
|
return [
|
|
|
|
'Content-Type: ' . $soapRequest->getContentType(),
|
|
|
|
'SOAPAction: "' . $soapRequest->getAction() . '"',
|
|
|
|
'Connection: ' . ($this->soapOptions->isConnectionKeepAlive() ? 'Keep-Alive' : 'close'),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
return [
|
|
|
|
'Content-Type: ' . $soapRequest->getContentType() . '; action="' . $soapRequest->getAction() . '"',
|
|
|
|
'Connection: ' . ($this->soapOptions->isConnectionKeepAlive() ? 'Keep-Alive' : 'close'),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2016-11-08 15:42:52 +01:00
|
|
|
private function getAttachmentFilters()
|
|
|
|
{
|
|
|
|
$filters = [];
|
|
|
|
if ($this->soapOptions->getAttachmentType() !== SoapOptions::SOAP_ATTACHMENTS_TYPE_BASE64) {
|
|
|
|
$filters[] = new MimeFilter();
|
|
|
|
}
|
|
|
|
if ($this->soapOptions->getAttachmentType() === SoapOptions::SOAP_ATTACHMENTS_TYPE_MTOM) {
|
|
|
|
$filters[] = new XmlMimeFilter();
|
|
|
|
}
|
|
|
|
|
|
|
|
return $filters;
|
|
|
|
}
|
2017-02-03 15:22:37 +01:00
|
|
|
|
|
|
|
private function returnSoapResponseByTracing(
|
|
|
|
SoapRequest $soapRequest,
|
|
|
|
CurlResponse $curlResponse,
|
|
|
|
SoapResponseTracingData $soapResponseTracingData,
|
|
|
|
array $soapAttachments = []
|
|
|
|
) {
|
2017-04-04 18:36:18 +02:00
|
|
|
if ($this->soapClientOptions->getTrace() === true) {
|
2017-02-03 15:22:37 +01:00
|
|
|
return SoapResponseFactory::createWithTracingData(
|
2017-04-04 18:36:18 +02:00
|
|
|
$soapRequest,
|
2017-02-03 15:22:37 +01:00
|
|
|
$curlResponse->getResponseBody(),
|
|
|
|
$curlResponse->getHttpResponseContentType(),
|
|
|
|
$soapResponseTracingData,
|
|
|
|
$soapAttachments
|
|
|
|
);
|
|
|
|
}
|
2017-05-26 10:53:41 +02:00
|
|
|
|
|
|
|
return SoapResponseFactory::create(
|
2017-06-16 13:42:08 +02:00
|
|
|
$soapRequest,
|
2017-05-26 10:53:41 +02:00
|
|
|
$curlResponse->getResponseBody(),
|
|
|
|
$curlResponse->getHttpResponseContentType(),
|
|
|
|
$soapAttachments
|
|
|
|
);
|
2017-02-03 15:22:37 +01:00
|
|
|
}
|
|
|
|
|
2017-04-04 18:36:18 +02:00
|
|
|
/**
|
|
|
|
* @param string $soapFaultCode
|
|
|
|
* @param string $soapFaultMessage
|
|
|
|
* @param SoapResponseTracingData $soapResponseTracingData
|
|
|
|
* @throws SoapFault
|
|
|
|
*/
|
|
|
|
private function throwSoapFaultByTracing($soapFaultCode, $soapFaultMessage, SoapResponseTracingData $soapResponseTracingData)
|
2017-02-03 15:22:37 +01:00
|
|
|
{
|
2017-04-04 18:36:18 +02:00
|
|
|
if ($this->soapClientOptions->getTrace() === true) {
|
2017-02-03 15:22:37 +01:00
|
|
|
|
|
|
|
throw new SoapFaultWithTracingData(
|
|
|
|
$soapFaultCode,
|
|
|
|
$soapFaultMessage,
|
|
|
|
$soapResponseTracingData
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2017-05-26 10:53:41 +02:00
|
|
|
throw new SoapFault(
|
|
|
|
$soapFaultCode,
|
|
|
|
$soapFaultMessage
|
|
|
|
);
|
2017-02-03 15:22:37 +01:00
|
|
|
}
|
2017-02-17 03:19:22 +01:00
|
|
|
|
2017-06-16 13:42:08 +02:00
|
|
|
private function decorateNativeSoapFaultWithSoapResponseTracingData(SoapFault $nativePhpSoapFault)
|
2017-02-17 03:19:22 +01:00
|
|
|
{
|
2017-06-16 13:42:08 +02:00
|
|
|
return $this->throwSoapFaultByTracing(
|
|
|
|
$nativePhpSoapFault->faultcode,
|
|
|
|
$nativePhpSoapFault->getMessage(),
|
|
|
|
$this->getSoapResponseTracingDataFromNativeSoapFaultOrStorage($nativePhpSoapFault)
|
|
|
|
);
|
2017-02-17 03:19:22 +01:00
|
|
|
}
|
|
|
|
|
2017-06-16 13:42:08 +02:00
|
|
|
private function getSoapResponseTracingDataFromNativeSoapFaultOrStorage(SoapFault $nativePhpSoapFault)
|
|
|
|
{
|
2017-05-30 18:29:51 +02:00
|
|
|
if ($nativePhpSoapFault instanceof SoapFaultWithTracingData) {
|
|
|
|
return $nativePhpSoapFault->getSoapResponseTracingData();
|
|
|
|
}
|
|
|
|
|
2017-06-16 13:42:08 +02:00
|
|
|
return $this->getSoapResponseTracingDataFromRequestStorage();
|
2017-05-30 18:29:51 +02:00
|
|
|
}
|
|
|
|
|
2017-06-16 13:42:08 +02:00
|
|
|
private function getSoapResponseTracingDataFromRequestStorage()
|
2017-02-17 03:19:22 +01:00
|
|
|
{
|
2017-06-16 13:42:08 +02:00
|
|
|
$lastResponseHeaders = $lastResponse = $lastRequestHeaders = $lastRequest = null;
|
|
|
|
$soapResponse = $this->getSoapResponseFromStorage();
|
|
|
|
if ($soapResponse instanceof SoapResponse) {
|
|
|
|
$lastResponseHeaders = 'Content-Type: ' . $soapResponse->getContentType();
|
|
|
|
$lastResponse = $soapResponse->getResponseContent();
|
2017-02-17 03:19:22 +01:00
|
|
|
|
2017-06-16 13:42:08 +02:00
|
|
|
if ($soapResponse->hasRequest() === true) {
|
|
|
|
$lastRequestHeaders = 'Content-Type: ' . $soapResponse->getRequest()->getContentType();
|
|
|
|
$lastRequest = $soapResponse->getRequest()->getContent();
|
|
|
|
}
|
2017-05-26 10:53:41 +02:00
|
|
|
}
|
2017-02-17 03:19:22 +01:00
|
|
|
|
2017-06-16 13:42:08 +02:00
|
|
|
return new SoapResponseTracingData(
|
|
|
|
$lastRequestHeaders,
|
|
|
|
$lastRequest,
|
|
|
|
$lastResponseHeaders,
|
|
|
|
$lastResponse
|
|
|
|
);
|
2017-02-17 03:19:22 +01:00
|
|
|
}
|
2016-11-08 15:42:52 +01:00
|
|
|
}
|