【发布时间】:2014-02-18 17:28:50
【问题描述】:
这在我的 WAMP 服务器上可以正常工作,但在 linux 主服务器上不起作用!?
try{
$client = new SoapClient('http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl', ['trace' => true]);
$result = $client->checkVat([
'countryCode' => 'DK',
'vatNumber' => '47458714'
]);
print_r($result);
}
catch(Exception $e){
echo $e->getMessage();
}
我在这里错过了什么?! :(
SOAP 已启用
错误
SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl' : failed to load external entity "http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl"/taxation_customs/vies/checkVatService.wsdl"
从 PHP 调用 URL
从 PHP 调用 URL 返回错误
$wsdl = file_get_contents('http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl');
echo $wsdl;
错误
Warning: file_get_contents(http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl): failed to open stream: HTTP request failed! HTTP/1.0 503 Service Unavailable
从命令行调用 URL
从 linux 命令行调用 URL HTTP 200 会返回一个 XML 响应
curl http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl
【问题讨论】:
-
如果你在 Linux 服务器的 shell 上运行
curl http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl会说什么? -
HTTP 200 和 XML 是响应
-
听起来可能是字符编码问题。 WDSL 是否以 SOAP 客户端期望的字符集编码?