php soap出错
出错信息:
<coding-1 lang="error">
Message = SoapFault exception: [HTTP] Could not connect to host in D:\www\Study\Soap\nowsdl\client.php:5 Stack trace: #0 [internal function]: SoapClient->__doRequest('__soapCall('greet', Array) #2 {main}/n
</coding>
配置:
extension=php_soap.dll 去掉了前面;去掉
phpinfo()也显示了;
client.php客户端代码
<?php
set_time_limit(0);
try {
$client = new SoapClient(null,array('location' => 'http://localhost/Study/Soap/server.php','uri' => 'http://localhost/helloService'));
$result = $client->__soapCall('greet', array(new SoapParam('Sam', 'name')));
printf("Result = %s/n", $result);
} catch (Exception $e) {
printf("Message = %s/n",$e->__toString());
}
?>
server.php服务端代码
<?php
set_time_limit(0);
try {
$client = new SoapClient(null,array('location' => 'http://localhost/Study/Soap/server.php','uri' => 'http://localhost/helloService'));
$result = $client->__soapCall('greet', array(new SoapParam('Sam', 'name')));
printf("Result = %s/n", $result);
} catch (Exception $e) {
printf("Message = %s/n",$e->__toString());
}
?>
圆脸D鬼神
10 years, 9 months ago
Answers
问题已经解决:
http://localhost/*********************
改成:
httP://127.0.0.1/*********************
就可以了。
也可以改成域名。前提是一定可以访问到该文件。
小早川凜子
answered 10 years, 9 months ago