joh*_*n84 2 php soap wsdl nusoap
我尝试使用PHP使用一个简单的Web服务,但是我得到以下错误消息(因为在我看来)说SOAP URL无法打开,但在浏览器中它确实可以正常工作(http://www.webservicex) .NET/uklocation.asmx?WSDL).
任何想法我的错误在哪里?
错误消息:
警告:SoapClient :: SoapClient(http://www.webservicex.net/uklocation.asmx?WSDL)[soapclient.soapclient]:无法打开流:连接在/ home/sia-deutschland_de/www/tests/test中超时第14行的.php
警告:SoapClient :: SoapClient()[soapclient.soapclient]:I/O警告:无法在/ home/sia-deutschland_de/www中加载外部实体"http://www.webservicex.net/uklocation.asmx?WSDL"第14行的/tests/test.php异常错误!
SOAP-ERROR:解析WSDL:无法从'http://www.webservicex.net/uklocation.asmx?WSDL'加载:无法加载外部实体"http://www.webservicex.net/uklocation.asmx? WSDL"
我的代码:
<?php
// include the SOAP classes
require_once('nusoap.php');
try {
$options = array(
'soap_version'=>SOAP_1_2,
'exceptions'=>true,
'trace'=>1,
'cache_wsdl'=>WSDL_CACHE_NONE
);
$client = new SoapClient("http://www.webservicex.net/uklocation.asmx?WSDL", $options);
// Note where 'Get' and 'request' tags are in the XML
//$client = new soapclient("http://www.webservicex.net/uklocation.asmx?WSDL", $options);
$err = $client->getError();
if ($err) {
// Display the error
echo 'client construction error: ' . $err ;
} else {
$answer = $client->call(’GetUKLocationByCounty’,
array(
'Country'=>'London'));
$err = $client->getError();
if ($err) {
// Display the error
echo 'Call error: ' . $err;
print_r($client->response);
print_r($client->getDebug());
} else {
print_r($answer);
}
}
} catch (Exception $e) {
echo "<h2>Exception Error!</h2>";
echo $e->getMessage();
}
?>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
17363 次 |
最近记录: |