SoapClient:错误代码 WSDL

发布于 2024-12-25 06:52:18 字数 582 浏览 1 评论 0原文

当我尝试使用 SoapClient:

try {
    $client = new SoapClient('http://someurl/somefile.wsdl');
} catch (SoapFault $e) {
    var_dump($e);
}

我遇到错误:

["faultstring"] => "SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://someurl/somefile.wsdl' : failed to load external entity "http://someurl/somefile.wsdl"
["faultcode"] => "WSDL"

我可以手动下载 http://someurl/somefile.wsdl 并可以 file_get_contents 获取此文件。我之前尝试在不同的计算机上使用它并且它有效。 php 或 apache 设置可能存在问题。ArchLinux

包含 php 和 apache 的最新更新。我尝试启用所有 php 扩展。

When I try to use SoapClient:

try {
    $client = new SoapClient('http://someurl/somefile.wsdl');
} catch (SoapFault $e) {
    var_dump($e);
}

I have catch error with:

["faultstring"] => "SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://someurl/somefile.wsdl' : failed to load external entity "http://someurl/somefile.wsdl"
["faultcode"] => "WSDL"

I can manually download http://someurl/somefile.wsdl and can file_get_contents for this file. I try to use it before on different computer and it worked. Possible problem with php or apache settings..

ArchLinux with last updates for php and apache. I tried to enable all php extensions.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

陪我终i 2025-01-01 06:52:18

您是否能够在浏览器中使用 file_get_contents() 获取 wsdl?

我最近在 Archlinux 中遇到了类似的问题,具有相同的错误字符串,无论使用什么 wsdl 文件。相同的代码在其他 Archlinux 机器和 Windows XP 机器上运行没有任何问题。

经过一些研究,发现只有当我尝试在浏览器中访问该页面时才会出现问题 - 从命令行访问的脚本按预期工作。然后我更改了脚本,使用前面提到的 file_get_contents() 直接下载 wsdl 文件 - 它给了我一个警告 “php_network_getaddresses: getaddrinfo failed: Name or service notknown”

很少有教程(关于SO,或者这个:http://albertech.net/2011/05/fix-php_network_getaddresses-getaddrinfo-failed-name-or-service-not-known/ )后来我还没有解决这个问题。但后来我发现是什么引入了问题:自从安装 Arch (为了更好地处理无线)以来我一直在运行 NetworkManager,几周后我将 mysqld 和 httpd 添加到了 rc.conf 中的 DAEMONS 部分 - 看起来是这样破坏了 apache 的 DNS 解析。

有两种解决方案(返回手动启动服务器或尝试其他网络管理器)我已切换到 wicd 并且没有再次遇到该问题。

Were you able to get wsdl using file_get_contents() in browser?

I had similar issue recently in Archlinux with same faultstring, no matter what wsdl file was used. The same code was working without any problem on other Archlinux machine and Windows XP box.

After some research, it came out that problem arose only when I tried to access the page in browser - script accessed from command line worked as expected. Then I changed the script to download the wsdl file directly, using aforementioned file_get_contents() - it gave me a warning "php_network_getaddresses: getaddrinfo failed: Name or service not known".

Few tutorials (on SO, or this one: http://albertech.net/2011/05/fix-php_network_getaddresses-getaddrinfo-failed-name-or-service-not-known/ ) later I haven't fought off the problem yet. But then I discovered what introduced the issues: I had been running NetworkManager since the installation of Arch (to better handle wireless), and few weeks later I've added mysqld and httpd as last to DAEMONS section in rc.conf - it seems this broke DNS resolution for apache.

Having two solutions (go back to starting servers manually or try other network manager) I've switched to wicd and haven't run into the issue again.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文