从 paypal 加载 WSDL 时 PHP SOAP 客户端抛出错误
$wsdl = "https://www.sandbox.paypal.com/wsdl/PayPalSvc.wsdl";
$soap = new SoapClient($wsdl);
抛出错误:
SOAP-ERROR:解析架构:顺序意外
在 PHP 版本 5.3.4、5.3.0 上尝试过
$wsdl = "https://www.sandbox.paypal.com/wsdl/PayPalSvc.wsdl";
$soap = new SoapClient($wsdl);
throws the error:
SOAP-ERROR: Parsing Schema: unexpected in sequence
Tried on PHP versions 5.3.4, 5.3.0
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
问题出在 https://www.paypalobjects.com/wsdl/eBLBaseComponents.xsd这是 https://www.paypalobjects.com/wsdl/PayPalSvc.wsdl
要解决此问题,您可以下载 WSDL 及其依赖项并手动修复 eBLBaseComponents.xsd(删除 后右下数第四行中错误的额外 >)。
1)下载以下4个文件到同一目录
https://www.paypal.com/wsdl/ PayPalSvc.wsdl
https://www.paypal.com/wsdl/eBLBaseComponents.xsd
https://www.paypal.com/wsdl/CoreComponentTypes.xsd
https://www.paypal.com/wsdl/EnhancedDataTypes.xsd
2) 删除错误的额外“>”位于 eBLBaseComponents.xsd 底部第四行。
3) 将您的更改上传到您自己的主机,或根据您的应用程序将其存储在本地。
4) 在您的应用程序中,指向新的、固定的 WSDL。
The problem is in https://www.paypalobjects.com/wsdl/eBLBaseComponents.xsd which is a dependency for https://www.paypalobjects.com/wsdl/PayPalSvc.wsdl
To work around this issue, you can download the WSDL and its dependencies and fix eBLBaseComponents.xsd manually (remove the erroneous extra > on the fourth line from the bottom right after ).
1) Download the following 4 files to the same directory
https://www.paypal.com/wsdl/PayPalSvc.wsdl
https://www.paypal.com/wsdl/eBLBaseComponents.xsd
https://www.paypal.com/wsdl/CoreComponentTypes.xsd
https://www.paypal.com/wsdl/EnhancedDataTypes.xsd
2) Remove the erroneous extra ">" on the fourth line from the bottom for eBLBaseComponents.xsd.
3) Upload your changes to your own host, or store them locally depending on your application.
4) In your application, point to the new, fixed WSDL.
看来 Paypal 只接受授权连接到此 SOAP url。
您可以在此处阅读相关内容 。
It seems Paypal accept only the authorized connect to this SOAP url.
You can read about it here.