首先soap的调试是个问题,这里找到一篇文章,可以调试soap,可以参考
地址:http://zccst.iteye.com/blog/1225071
主要实现代码如下:
/**
* 设置参数array("trace"=>true)用于调试
* __getLastRequest 返回请求信息
* __getLastResponse 返回响应信息包括报错信息都会返回
*/
try{
$client = new SoapClient($server,array("trace"=>true));
$client->method($args);
}catch(SoapFault $e){
echo $client->__getLastRequest();
echo $client->__getLastResponse();
echo $e->getMessage();
}
先在本地测试,没有问题,然后wsdl是用程序生成的,感觉wsdl里面的地址有问题,我就手动改了IP
然后服务器上测试就只得到一个结果:
Could not connect to host
毫无办法
然后,到处找啊找,网上得出几个结果,服务器网络问题
我就去Ping啊,设置IP啊什么的,结果都通啊
再找,然后有位网友有个解决方案:
地址如下:http://my.oschina.net/phpmst/blog/86359
但是一看,貌似不是很靠谱啊,没尝试,继续找
于是在国外找到一个解决方案,是因为php.ini里的wsdl的缓存问题,一想,这可能性很大,首先环境是集成环境,很可能问题就在这里了
于是,打开PHP.INI一看,我靠,还真设置了缓存
然后把参数全改了
结果就对了
国外解决方案地址:
http://stackoverflow.com/questions/4318870/soapfault-exception-could-not-connect-to-host
涉及的Php.ini的几个参数
[soap]
; Enables or disables WSDL caching feature.
; http://php.net/soap.wsdl-cache-enabled
;这个要改为0
soap.wsdl_cache_enabled=0
; Sets the directory name where SOAP extension will put cache files.
; http://php.net/soap.wsdl-cache-dir
soap.wsdl_cache_dir="/tmp"
; (time to live) Sets the number of second while cached file will be used
; instead of original one.
; http://php.net/soap.wsdl-cache-ttl
;这个要改为0
soap.wsdl_cache_ttl=0
; Sets the size of the cache limit. (Max. number of WSDL files to cache)
;这个我也改了,你看着办
soap.wsdl_cache_limit = 0