Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
0e2c33faf8 | |||
cf6e147c26 | |||
f276a30a47 | |||
4edc46e67f | |||
a76526a5b6 | |||
baf32c1350 | |||
5c0bf914e3 | |||
01d10b89fd | |||
e1b50ce914 | |||
68b41acc46 |
@ -62,7 +62,7 @@ class Curl
|
|||||||
curl_setopt_array($curlSession, [
|
curl_setopt_array($curlSession, [
|
||||||
CURLOPT_ENCODING => '',
|
CURLOPT_ENCODING => '',
|
||||||
CURLOPT_SSL_VERIFYPEER => false,
|
CURLOPT_SSL_VERIFYPEER => false,
|
||||||
CURLOPT_FAILONERROR => true,
|
CURLOPT_FAILONERROR => false,
|
||||||
CURLOPT_RETURNTRANSFER => true,
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||||
CURLOPT_HEADER => true,
|
CURLOPT_HEADER => true,
|
||||||
@ -147,6 +147,8 @@ class Curl
|
|||||||
$headerSize = curl_getinfo($curlSession, CURLINFO_HEADER_SIZE);
|
$headerSize = curl_getinfo($curlSession, CURLINFO_HEADER_SIZE);
|
||||||
$httpResponseCode = curl_getinfo($curlSession, CURLINFO_HTTP_CODE);
|
$httpResponseCode = curl_getinfo($curlSession, CURLINFO_HTTP_CODE);
|
||||||
$httpResponseContentType = curl_getinfo($curlSession, CURLINFO_CONTENT_TYPE);;
|
$httpResponseContentType = curl_getinfo($curlSession, CURLINFO_CONTENT_TYPE);;
|
||||||
|
$responseBody = substr($executeSoapCallResponse, $headerSize);
|
||||||
|
$responseHeaders = substr($executeSoapCallResponse, 0, $headerSize);
|
||||||
preg_match('/HTTP\/(1\.[0-1]+) ([0-9]{3}) (.*)/', $executeSoapCallResponse, $httpResponseMessages);
|
preg_match('/HTTP\/(1\.[0-1]+) ([0-9]{3}) (.*)/', $executeSoapCallResponse, $httpResponseMessages);
|
||||||
$httpResponseMessage = trim(array_pop($httpResponseMessages));
|
$httpResponseMessage = trim(array_pop($httpResponseMessages));
|
||||||
$curlErrorMessage = sprintf(
|
$curlErrorMessage = sprintf(
|
||||||
@ -156,7 +158,7 @@ class Curl
|
|||||||
$location
|
$location
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($executeSoapCallResponse === false) {
|
if (!is_integer($httpResponseCode) || $httpResponseCode >= 400 || $httpResponseCode === 0) {
|
||||||
|
|
||||||
return new CurlResponse(
|
return new CurlResponse(
|
||||||
$httpRequestHeadersAsString,
|
$httpRequestHeadersAsString,
|
||||||
@ -164,6 +166,8 @@ class Curl
|
|||||||
$httpResponseMessage,
|
$httpResponseMessage,
|
||||||
$httpResponseContentType,
|
$httpResponseContentType,
|
||||||
self::CURL_FAILED,
|
self::CURL_FAILED,
|
||||||
|
$responseHeaders,
|
||||||
|
$responseBody,
|
||||||
$curlErrorMessage
|
$curlErrorMessage
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -174,9 +178,8 @@ class Curl
|
|||||||
$httpResponseMessage,
|
$httpResponseMessage,
|
||||||
$httpResponseContentType,
|
$httpResponseContentType,
|
||||||
self::CURL_SUCCESS,
|
self::CURL_SUCCESS,
|
||||||
null,
|
$responseHeaders,
|
||||||
substr($executeSoapCallResponse, 0, $headerSize),
|
$responseBody
|
||||||
substr($executeSoapCallResponse, $headerSize)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ use Exception;
|
|||||||
class CurlOptionsBuilder
|
class CurlOptionsBuilder
|
||||||
{
|
{
|
||||||
const DEFAULT_MAX_REDIRECTS = 10;
|
const DEFAULT_MAX_REDIRECTS = 10;
|
||||||
const DEFAULT_CONNECTION_TIMEOUT = 10;
|
const DEFAULT_CONNECTION_TIMEOUT = 120;
|
||||||
|
|
||||||
public static function buildDefault()
|
public static function buildDefault()
|
||||||
{
|
{
|
||||||
|
@ -19,9 +19,9 @@ class CurlResponse
|
|||||||
$httpResponseStatusMessage,
|
$httpResponseStatusMessage,
|
||||||
$httpResponseContentType,
|
$httpResponseContentType,
|
||||||
$curlStatus,
|
$curlStatus,
|
||||||
$curlErrorMessage = null,
|
$responseHeader,
|
||||||
$responseHeader = null,
|
$responseBody,
|
||||||
$responseBody = null
|
$curlErrorMessage = null
|
||||||
) {
|
) {
|
||||||
$this->httpRequestHeaders = $httpRequestHeaders;
|
$this->httpRequestHeaders = $httpRequestHeaders;
|
||||||
$this->httpResponseStatusCode = $httpResponseStatusCode;
|
$this->httpResponseStatusCode = $httpResponseStatusCode;
|
||||||
@ -78,21 +78,11 @@ class CurlResponse
|
|||||||
return $this->curlErrorMessage;
|
return $this->curlErrorMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hasResponseHeader()
|
|
||||||
{
|
|
||||||
return $this->responseHeader !== null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getResponseHeader()
|
public function getResponseHeader()
|
||||||
{
|
{
|
||||||
return $this->responseHeader;
|
return $this->responseHeader;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hasResponseBody()
|
|
||||||
{
|
|
||||||
return $this->responseBody !== null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getResponseBody()
|
public function getResponseBody()
|
||||||
{
|
{
|
||||||
return $this->responseBody;
|
return $this->responseBody;
|
||||||
|
@ -71,7 +71,7 @@ class MimeFilter implements SoapRequestFilter, SoapResponseFilter
|
|||||||
$soapPart = $multiPartMessage->getMainPart();
|
$soapPart = $multiPartMessage->getMainPart();
|
||||||
$attachments = $multiPartMessage->getAttachments();
|
$attachments = $multiPartMessage->getAttachments();
|
||||||
|
|
||||||
$response->setContent($this->sanitizePhpExceptionOnHrefs($soapPart));
|
$response->setContent($soapPart->getContent());
|
||||||
$response->setContentType($soapPart->getHeader('Content-Type'));
|
$response->setContentType($soapPart->getHeader('Content-Type'));
|
||||||
if (count($attachments) > 0) {
|
if (count($attachments) > 0) {
|
||||||
$response->setAttachments($attachments);
|
$response->setAttachments($attachments);
|
||||||
|
@ -41,6 +41,10 @@ class SoapClient extends \SoapClient
|
|||||||
protected $soapClientOptions;
|
protected $soapClientOptions;
|
||||||
protected $soapOptions;
|
protected $soapOptions;
|
||||||
private $curl;
|
private $curl;
|
||||||
|
/** @var SoapAttachment[] */
|
||||||
|
private $soapAttachmentsOnRequestStorage;
|
||||||
|
/** @var SoapResponse */
|
||||||
|
private $soapResponseStorage;
|
||||||
|
|
||||||
public function __construct(SoapClientOptions $soapClientOptions, SoapOptions $soapOptions)
|
public function __construct(SoapClientOptions $soapClientOptions, SoapOptions $soapOptions)
|
||||||
{
|
{
|
||||||
@ -51,20 +55,20 @@ class SoapClient extends \SoapClient
|
|||||||
);
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@parent::__construct(
|
$wsdlPath = $this->loadWsdl(
|
||||||
$this->loadWsdl(
|
$this->curl,
|
||||||
$this->curl,
|
$soapOptions->getWsdlFile(),
|
||||||
$soapOptions->getWsdlFile(),
|
$soapOptions->getWsdlCacheType(),
|
||||||
$soapOptions->getWsdlCacheType()
|
false
|
||||||
),
|
|
||||||
$soapClientOptions->toArray() + $soapOptions->toArray()
|
|
||||||
);
|
);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw new SoapFault(
|
throw new SoapFault(
|
||||||
SoapFaultEnum::SOAP_FAULT_SOAP_CLIENT_ERROR,
|
SoapFaultEnum::SOAP_FAULT_SOAP_CLIENT_ERROR,
|
||||||
'Could not create SoapClient instance with message: '.$e->getMessage()
|
'Unable to load WsdlPath ('.$soapOptions->getWsdlFile().') with message: '.$e->getMessage().' in file: '.$e->getFile().' (line: '.$e->getLine().')'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@parent::__construct($wsdlPath, $soapClientOptions->toArray() + $soapOptions->toArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -82,20 +86,20 @@ class SoapClient extends \SoapClient
|
|||||||
/**
|
/**
|
||||||
* Using __soapCall returns only response string, use soapCall instead.
|
* Using __soapCall returns only response string, use soapCall instead.
|
||||||
*
|
*
|
||||||
* @param string $functionName
|
* @param string $function_name
|
||||||
* @param array $arguments
|
* @param array $arguments
|
||||||
* @param array|null $options
|
* @param array|null $options
|
||||||
* @param null $inputHeaders
|
* @param null $input_headers
|
||||||
* @param array|null $outputHeaders
|
* @param array|null $output_headers
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function __soapCall($functionName, $arguments, $options = null, $inputHeaders = null, &$outputHeaders = null)
|
public function __soapCall($function_name, $arguments, $options = null, $input_headers = null, &$output_headers = null)
|
||||||
{
|
{
|
||||||
return $this->soapCall($functionName, $arguments, $options, $inputHeaders, $outputHeaders)->getContent();
|
return $this->soapCall($function_name, $arguments, $options, $input_headers, $output_headers)->getResponseContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $functionName
|
* @param string $functionName
|
||||||
* @param array $arguments
|
* @param array $arguments
|
||||||
* @param array|null $options
|
* @param array|null $options
|
||||||
* @param SoapAttachment[] $soapAttachments
|
* @param SoapAttachment[] $soapAttachments
|
||||||
@ -105,17 +109,13 @@ class SoapClient extends \SoapClient
|
|||||||
*/
|
*/
|
||||||
public function soapCall($functionName, array $arguments, array $soapAttachments = [], array $options = null, $inputHeaders = null, array &$outputHeaders = null)
|
public function soapCall($functionName, array $arguments, array $soapAttachments = [], array $options = null, $inputHeaders = null, array &$outputHeaders = null)
|
||||||
{
|
{
|
||||||
ob_start();
|
$this->setSoapAttachmentsOnRequestToStorage($soapAttachments);
|
||||||
parent::__soapCall($functionName, $arguments, $options, $inputHeaders, $outputHeaders);
|
$soapResponseAsObject = parent::__soapCall($functionName, $arguments, $options, $inputHeaders, $outputHeaders);
|
||||||
$nativeSoapClientRequest = $this->mapNativeDataJsonToDto(ob_get_clean());
|
|
||||||
|
|
||||||
return $this->performSoapRequest(
|
$soapResponse = $this->getSoapResponseFromStorage();
|
||||||
$nativeSoapClientRequest->request,
|
$soapResponse->setResponseObject($soapResponseAsObject);
|
||||||
$nativeSoapClientRequest->location,
|
|
||||||
$nativeSoapClientRequest->action,
|
return $soapResponse;
|
||||||
$nativeSoapClientRequest->version,
|
|
||||||
$soapAttachments
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -131,34 +131,16 @@ class SoapClient extends \SoapClient
|
|||||||
*/
|
*/
|
||||||
public function __doRequest($request, $location, $action, $version, $oneWay = 0)
|
public function __doRequest($request, $location, $action, $version, $oneWay = 0)
|
||||||
{
|
{
|
||||||
$soapClientNativeDataTransferObject = new SoapClientNativeDataTransferObject(
|
$soapResponse = $this->performSoapRequest(
|
||||||
$request,
|
$request,
|
||||||
$location,
|
$location,
|
||||||
$action,
|
$action,
|
||||||
$version
|
$version,
|
||||||
|
$this->getSoapAttachmentsOnRequestFromStorage()
|
||||||
);
|
);
|
||||||
echo json_encode($soapClientNativeDataTransferObject);
|
$this->setSoapResponseToStorage($soapResponse);
|
||||||
|
|
||||||
return $request;
|
return $soapResponse->getResponseContent();
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
public function performSoapRequest($request, $location, $action, $version, array $soapAttachments = [])
|
|
||||||
{
|
|
||||||
$soapRequest = $this->createSoapRequest($location, $action, $version, $request, $soapAttachments);
|
|
||||||
|
|
||||||
return $this->performHttpSoapRequest($soapRequest);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated */
|
/** @deprecated */
|
||||||
@ -201,6 +183,25 @@ class SoapClient extends \SoapClient
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
private function performSoapRequest($request, $location, $action, $version, array $soapAttachments = [])
|
||||||
|
{
|
||||||
|
$soapRequest = $this->createSoapRequest($location, $action, $version, $request, $soapAttachments);
|
||||||
|
|
||||||
|
return $this->performHttpSoapRequest($soapRequest);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $location Location
|
* @param string $location Location
|
||||||
* @param string $action SOAP action
|
* @param string $action SOAP action
|
||||||
@ -248,7 +249,7 @@ class SoapClient extends \SoapClient
|
|||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
$headers = [
|
$headers = [
|
||||||
'Content-Type:' . $soapRequest->getContentType() . '; action="' . $soapRequest->getAction() . '"',
|
'Content-Type:' . $soapRequest->getContentType() . '; action="' . $soapRequest->getAction() . '"',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
$curlResponse = $this->curl->executeCurlWithCachedSession(
|
$curlResponse = $this->curl->executeCurlWithCachedSession(
|
||||||
@ -311,14 +312,13 @@ class SoapClient extends \SoapClient
|
|||||||
*/
|
*/
|
||||||
private function loadWsdl(Curl $curl, $wsdlPath, $wsdlCacheType, $resolveRemoteIncludes = true)
|
private function loadWsdl(Curl $curl, $wsdlPath, $wsdlCacheType, $resolveRemoteIncludes = true)
|
||||||
{
|
{
|
||||||
|
$wsdlDownloader = new WsdlDownloader();
|
||||||
$wsdlDownloader = new WsdlDownloader($curl);
|
|
||||||
try {
|
try {
|
||||||
$loadedWsdlFilePath = $wsdlDownloader->getWsdlPath($curl, $wsdlPath, $wsdlCacheType, $resolveRemoteIncludes);
|
$loadedWsdlFilePath = $wsdlDownloader->getWsdlPath($curl, $wsdlPath, $wsdlCacheType, $resolveRemoteIncludes);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw new SoapFault(
|
throw new SoapFault(
|
||||||
SoapFaultEnum::SOAP_FAULT_WSDL,
|
SoapFaultEnum::SOAP_FAULT_WSDL,
|
||||||
'Unable to load WsdlPath: ' . $e->getMessage()
|
'Unable to load WsdlPath ('.$wsdlPath.') with message: '.$e->getMessage().' in file: '.$e->getFile().' (line: '.$e->getLine().')'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -338,18 +338,6 @@ class SoapClient extends \SoapClient
|
|||||||
return $filters;
|
return $filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function mapNativeDataJsonToDto($nativeDataJson)
|
|
||||||
{
|
|
||||||
$nativeData = json_decode($nativeDataJson);
|
|
||||||
|
|
||||||
return new SoapClientNativeDataTransferObject(
|
|
||||||
$nativeData->request,
|
|
||||||
$nativeData->location,
|
|
||||||
$nativeData->action,
|
|
||||||
$nativeData->version
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function returnSoapResponseByTracing(
|
private function returnSoapResponseByTracing(
|
||||||
$isTracingEnabled,
|
$isTracingEnabled,
|
||||||
SoapRequest $soapRequest,
|
SoapRequest $soapRequest,
|
||||||
@ -407,4 +395,33 @@ class SoapClient extends \SoapClient
|
|||||||
throw new Exception('SoapClientOptions tracing disabled, turn on trace attribute');
|
throw new Exception('SoapClientOptions tracing disabled, turn on trace attribute');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function setSoapResponseToStorage(SoapResponse $soapResponseStorage)
|
||||||
|
{
|
||||||
|
$this->soapResponseStorage = $soapResponseStorage;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param SoapAttachment[] $soapAttachments
|
||||||
|
*/
|
||||||
|
private function setSoapAttachmentsOnRequestToStorage(array $soapAttachments)
|
||||||
|
{
|
||||||
|
$this->soapAttachmentsOnRequestStorage = $soapAttachments;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getSoapAttachmentsOnRequestFromStorage()
|
||||||
|
{
|
||||||
|
$soapAttachmentsOnRequest = $this->soapAttachmentsOnRequestStorage;
|
||||||
|
$this->soapAttachmentsOnRequestStorage = null;
|
||||||
|
|
||||||
|
return $soapAttachmentsOnRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getSoapResponseFromStorage()
|
||||||
|
{
|
||||||
|
$soapResponse = $this->soapResponseStorage;
|
||||||
|
$this->soapResponseStorage = null;
|
||||||
|
|
||||||
|
return $soapResponse;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace BeSimple\SoapClient;
|
|
||||||
|
|
||||||
class SoapClientNativeDataTransferObject
|
|
||||||
{
|
|
||||||
public $request;
|
|
||||||
public $location;
|
|
||||||
public $action;
|
|
||||||
public $version;
|
|
||||||
|
|
||||||
public function __construct($request, $location, $action, $version)
|
|
||||||
{
|
|
||||||
$this->request = $request;
|
|
||||||
$this->location = $location;
|
|
||||||
$this->action = $action;
|
|
||||||
$this->version = $version;
|
|
||||||
}
|
|
||||||
}
|
|
@ -6,8 +6,38 @@ use BeSimple\SoapCommon\SoapResponse as CommonSoapResponse;
|
|||||||
|
|
||||||
class SoapResponse extends CommonSoapResponse
|
class SoapResponse extends CommonSoapResponse
|
||||||
{
|
{
|
||||||
|
/** @var mixed */
|
||||||
|
protected $responseObject;
|
||||||
|
/** @var SoapResponseTracingData */
|
||||||
|
protected $tracingData;
|
||||||
|
|
||||||
public function getResponseContent()
|
public function getResponseContent()
|
||||||
{
|
{
|
||||||
return $this->getContent();
|
return $this->getContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getResponseObject()
|
||||||
|
{
|
||||||
|
return $this->responseObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setResponseObject($responseObject)
|
||||||
|
{
|
||||||
|
$this->responseObject = $responseObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function hasTracingData()
|
||||||
|
{
|
||||||
|
return $this->tracingData !== null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTracingData()
|
||||||
|
{
|
||||||
|
return $this->tracingData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setTracingData(SoapResponseTracingData $tracingData)
|
||||||
|
{
|
||||||
|
$this->tracingData = $tracingData;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ class WsdlDownloader
|
|||||||
$curlResponse = $curl->executeCurlWithCachedSession($wsdlPath);
|
$curlResponse = $curl->executeCurlWithCachedSession($wsdlPath);
|
||||||
if ($curlResponse->curlStatusSuccess()) {
|
if ($curlResponse->curlStatusSuccess()) {
|
||||||
if (mb_strlen($curlResponse->getResponseBody()) === 0) {
|
if (mb_strlen($curlResponse->getResponseBody()) === 0) {
|
||||||
throw new Exception('Could not write WSDL cache file: curl response empty');
|
throw new Exception('Could not write WSDL cache file: empty curl response from: '.$wsdlPath);
|
||||||
}
|
}
|
||||||
if ($resolveRemoteIncludes === true) {
|
if ($resolveRemoteIncludes === true) {
|
||||||
$document = $this->getXmlFileDOMDocument($curl, $cacheType, $curlResponse->getResponseBody(), $wsdlPath);
|
$document = $this->getXmlFileDOMDocument($curl, $cacheType, $curlResponse->getResponseBody(), $wsdlPath);
|
||||||
@ -180,26 +180,28 @@ class WsdlDownloader
|
|||||||
foreach ($nodes as $node) {
|
foreach ($nodes as $node) {
|
||||||
/** @var DOMElement $node */
|
/** @var DOMElement $node */
|
||||||
$locationPath = $node->getAttribute($locationAttributeName);
|
$locationPath = $node->getAttribute($locationAttributeName);
|
||||||
if ($this->isRemoteFile($locationPath)) {
|
if ($locationPath !== '') {
|
||||||
$node->setAttribute(
|
if ($this->isRemoteFile($locationPath)) {
|
||||||
$locationAttributeName,
|
$node->setAttribute(
|
||||||
$this->getWsdlPath(
|
$locationAttributeName,
|
||||||
$curl,
|
$this->getWsdlPath(
|
||||||
$locationPath,
|
$curl,
|
||||||
$cacheType,
|
$locationPath,
|
||||||
true
|
$cacheType,
|
||||||
)
|
true
|
||||||
);
|
)
|
||||||
} else if ($parentFilePath !== null) {
|
);
|
||||||
$node->setAttribute(
|
} else if ($parentFilePath !== null) {
|
||||||
$locationAttributeName,
|
$node->setAttribute(
|
||||||
$this->getWsdlPath(
|
$locationAttributeName,
|
||||||
$curl,
|
$this->getWsdlPath(
|
||||||
$this->resolveRelativePathInUrl($parentFilePath, $locationPath),
|
$curl,
|
||||||
$cacheType,
|
$this->resolveRelativePathInUrl($parentFilePath, $locationPath),
|
||||||
true
|
$cacheType,
|
||||||
)
|
true
|
||||||
);
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -218,7 +220,7 @@ class WsdlDownloader
|
|||||||
$urlParts = parse_url($base);
|
$urlParts = parse_url($base);
|
||||||
|
|
||||||
// combine base path with relative path
|
// combine base path with relative path
|
||||||
if (isset($urlParts['path']) && '/' === $relative{0}) {
|
if (isset($urlParts['path']) && mb_strlen($relative) > 0 && '/' === $relative{0}) {
|
||||||
// $relative is absolute path from domain (starts with /)
|
// $relative is absolute path from domain (starts with /)
|
||||||
$path = $relative;
|
$path = $relative;
|
||||||
} elseif (isset($urlParts['path']) && strrpos($urlParts['path'], '/') === (strlen($urlParts['path']) )) {
|
} elseif (isset($urlParts['path']) && strrpos($urlParts['path'], '/') === (strlen($urlParts['path']) )) {
|
||||||
|
@ -110,7 +110,8 @@ class Parser
|
|||||||
}
|
}
|
||||||
if (strpos($currentHeader, ':') !== false) {
|
if (strpos($currentHeader, ':') !== false) {
|
||||||
list($headerName, $headerValue) = explode(':', $currentHeader, 2);
|
list($headerName, $headerValue) = explode(':', $currentHeader, 2);
|
||||||
$headerValue = iconv_mime_decode($headerValue, 0, Part::CHARSET_UTF8);
|
$headerValueWithNoCrAtTheEnd = trim($headerValue);
|
||||||
|
$headerValue = iconv_mime_decode($headerValueWithNoCrAtTheEnd, 0, Part::CHARSET_UTF8);
|
||||||
$parsedMimeHeaders = ContentTypeParser::parseContentTypeHeader($headerName, $headerValue);
|
$parsedMimeHeaders = ContentTypeParser::parseContentTypeHeader($headerName, $headerValue);
|
||||||
foreach ($parsedMimeHeaders as $parsedMimeHeader) {
|
foreach ($parsedMimeHeaders as $parsedMimeHeader) {
|
||||||
$currentPart->setHeader(
|
$currentPart->setHeader(
|
||||||
|
@ -13,8 +13,6 @@
|
|||||||
|
|
||||||
namespace BeSimple\SoapCommon;
|
namespace BeSimple\SoapCommon;
|
||||||
|
|
||||||
use BeSimple\SoapClient\SoapResponseTracingData;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SOAP response message.
|
* SOAP response message.
|
||||||
*
|
*
|
||||||
@ -23,21 +21,4 @@ use BeSimple\SoapClient\SoapResponseTracingData;
|
|||||||
*/
|
*/
|
||||||
class SoapResponse extends SoapMessage
|
class SoapResponse extends SoapMessage
|
||||||
{
|
{
|
||||||
/** @var SoapResponseTracingData */
|
|
||||||
protected $tracingData;
|
|
||||||
|
|
||||||
public function hasTracingData()
|
|
||||||
{
|
|
||||||
return $this->tracingData !== null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getTracingData()
|
|
||||||
{
|
|
||||||
return $this->tracingData;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setTracingData(SoapResponseTracingData $tracingData)
|
|
||||||
{
|
|
||||||
$this->tracingData = $tracingData;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ class MimeFilter implements SoapRequestFilter, SoapResponseFilter
|
|||||||
$soapPart = $multiPartMessage->getMainPart();
|
$soapPart = $multiPartMessage->getMainPart();
|
||||||
$attachments = $multiPartMessage->getAttachments();
|
$attachments = $multiPartMessage->getAttachments();
|
||||||
|
|
||||||
$request->setContent($this->sanitizePhpExceptionOnHrefs($soapPart));
|
$request->setContent($soapPart->getContent());
|
||||||
$request->setContentType($soapPart->getHeader('Content-Type'));
|
$request->setContentType($soapPart->getHeader('Content-Type'));
|
||||||
if (count($attachments) > 0) {
|
if (count($attachments) > 0) {
|
||||||
$request->setAttachments($attachments);
|
$request->setAttachments($attachments);
|
||||||
|
Reference in New Issue
Block a user