当 wsdl 将服务端口绑定定义为 https 和端口 80 时,PHP SOAP 请求失败的解决方法?
我正在使用 php5 的肥皂扩展来使用 SOAP Web 服务。服务的 wsdl 是使用 Axis java2wsdl 生成的,生成过程中使用的任何选项都会导致端口绑定 URL 列为 https://xxx.xxx.xxx.xxx**:80**
如果我将 wsdl 下载到我的服务器,从端口绑定位置值中删除端口 80 规范,并在我的soapclient 调用中引用本地文件,它工作正常。
但是,如果我尝试远程引用它(或下载它并按原样在本地引用它),则调用会因肥皂故障而失败。
我没有对服务端进行任何输入,因此我无法让他们更改其 wsdl 生成过程。因此,除非有办法让soapclient不知道端口,否则我只能使用其他人的wsdl的本地修改副本(我宁愿不这样做)。
关于如何让我的肥皂客户端忽略端口 80 有什么想法吗?
I am consuming a SOAP web service using php5's soap extension. The service' wsdl was generated using Axis java2wsdl, and whatever options are used during generation result in the port binding url being listed as https://xxx.xxx.xxx.xxx**:80**
If I download the wsdl to my server, remove the port 80 specification from the port binding location value, and reference the local file in my soapclient call it works fine.
However, if I try to reference it remotely (or download it and reference it locally, as-is) the call fails with a soap fault.
I have no input into the service side so I can't make them change their wsdl-generation process. So, unless there's a way to make the soapclient ignorant of the port, I'm stuck with using a locally modified copy of someone else' wsdl (which I'd rather not do).
Any thoughts on how to make my soapclient ignore the port 80?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能想要尝试使用 $options 数组覆盖主机名/端口,您可以将其作为第二个参数传递给 SoapClient 的构造函数:
$client = new SoapClient("some.wsdl",
array('proxy_host' => "https://example.org",
'代理端口' => 443);
You might want to try overriding the hostname/port using the $options array that you can pass as the second argument to SoapClient's constructor:
$client = new SoapClient("some.wsdl",
array('proxy_host' => "https://example.org",
'proxy_port' => 443);
如果您找不到更优雅的解决方案,您可以随时下载该文件,进行字符串替换,然后将其用作 WSDL。
If you can't find a more elegant solution, you can always download the file, do the string replacements, then use that as the WSDL.