php webservice mysql_php webservice 可能存在的坑

场景:

今天在生产机器上调用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:Server

WSDL generation is not supported yet

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 原因找到 结案!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值