php webservice 可能存在的坑
2024-09-17 07:28:39
场景:
今天在生产机器上调用webservice失败 报 ...failed to load external entity...
wget一下地址发现报500错误 把wsdl去掉再wget 发现就没有任何问题 ,一想估计是生成wsdl协议时出错了 于是找一下接口方看看,但没有发现任何问题。
用soapUI加载失败
WSDLException (at /SOAP-ENV:Envelope): faultCode=INVALID_WSDL: Expected element '{http://schemas.xmlsoap.org/wsdl/}definitions'.
用浏览器打开接口地址发现一条信息(wget居然没给我显示出来)
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server</faultcode>
<faultstring>WSDL generation is not supported yet</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
WSDL generation is not supported yet 看到这句话 我在想平时加上wsdl难道是虚假的没用的?
单写一个php测试soap代码
$client = new SoapClient(null,array('location'=>'http://xxx.com/WebServerApi.php?wsdl','uri' =>'http://127.0.0.1/'));
发现去掉wsdl 和加上wsdl 完全没有任何影响,都能调取数据
再看看SoapClient方法解释
Description public SoapClient::SoapClient ( mixed $wsdl [, array $options ] )
This constructor creates SoapClient objects in WSDL or non-WSDL mode. Parameters wsdl
URI of the WSDL file or NULL if working in non-WSDL mode.
第一个参数是填的null 表示不需定义wsdl,用这种方式是无法跨语言访问服务,因为我们访问拿不到wsdl,php之间调用还是可以,果然代码里面的地址写成?wsdl是装逼用的。
如果把null改为wsdl地址就会抛出异常
SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://xxx.com/WebServerApi.php?wsdl' : failed to load external entity
ok 原因找到 结案!
最新文章
- iOS 圆角图片
- FMDB 版本迁移
- MongoDB空间整理
- Codeforces Round #205 (Div. 2) : A
- ORA-01722: invalid number,ORA-12801
- webservice中采用协议Http,它是指什么意思
- ue4中窗口打开web地址
- Codeforces 626C Block Towers(二分)
- 3.关于QT中的MainWindow窗口,MenuBar,ToolBar,QuickTip等方面的知识点
- OGG微服务架构入门
- Windows10安装pycocotools方法,亲测可用!
- (01) 什么是Spring Boot
- Install Kernel 3.10 on CentOS 6.5
- mysql 的 docker 镜像使用
- Linux中dpkg工具update-alternatives实现符号链接软件版本的切换(转)
- Tasks遇到的一些坑,关于在子线程中对线程权限认证。
- hive介绍
- Windows Phone 页面切换动画
- 「小程序JAVA实战」小程序视频列表到详情功能(58)
- IOS 了解新技术(UIPresentationController,屏幕适配)