SoapClient - WSDL download fixes
This commit is contained in:
parent
30a9707c59
commit
68b41acc46
|
@ -51,20 +51,19 @@ 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()
|
||||||
),
|
|
||||||
$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,16 +81,16 @@ 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)->getContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -311,14 +310,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().')'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -180,6 +180,7 @@ 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 ($locationPath !== '') {
|
||||||
if ($this->isRemoteFile($locationPath)) {
|
if ($this->isRemoteFile($locationPath)) {
|
||||||
$node->setAttribute(
|
$node->setAttribute(
|
||||||
$locationAttributeName,
|
$locationAttributeName,
|
||||||
|
@ -204,6 +205,7 @@ class WsdlDownloader
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolves the relative path to base into an absolute.
|
* Resolves the relative path to base into an absolute.
|
||||||
|
@ -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']) )) {
|
||||||
|
|
Loading…
Reference in New Issue