SoapClient 无法加载 WSDL,需要重新启动 apache 才能再次工作
SoapClient failing to load WSDL, needs apache restart to work again
服务器是 CENTOS PHP 5.4 和 Apache 2.2。
我有一个这样的 SoapClient 对象:
$client = new \SoapClient(__DIR__ . "/wsdlfilehere.wsdl", array("soap_version"=>SOAP_1_2, "trace"=>true));
一段时间后(24 小时内),此代码会引发错误:
SOAP-ERROR: Parsing WSDL: Couldn't load from '/wsdlfilehere.wsdl' : failed to load external entity "/wsdlfilehere.wsdl".
然后 在 之后我重新启动 apache,它再次工作。
编辑:即使将 cache_wsdl 设置为 WSDL_CACHE_NONE 也无法解决问题。
四处寻找后,我终于找到了 workaround/solution。
按照此 link on Ubuntu's launchpad it seems that other people are also experiencing this problem. I followed zabuch's instruction at comment #6 进行操作,现在似乎可以使用了。我同意他的看法,问题可能出在 mod_php/php 本身,而不仅仅是 Ubuntu,因为我在 CentOS 上并且遇到过这个问题。
来自zabuch的评论:
The workaround for the issue is to add this:
libxml_disable_entity_loader(false);
before creating new SoapClient.
服务器是 CENTOS PHP 5.4 和 Apache 2.2。
我有一个这样的 SoapClient 对象:
$client = new \SoapClient(__DIR__ . "/wsdlfilehere.wsdl", array("soap_version"=>SOAP_1_2, "trace"=>true));
一段时间后(24 小时内),此代码会引发错误:
SOAP-ERROR: Parsing WSDL: Couldn't load from '/wsdlfilehere.wsdl' : failed to load external entity "/wsdlfilehere.wsdl".
然后 在 之后我重新启动 apache,它再次工作。
编辑:即使将 cache_wsdl 设置为 WSDL_CACHE_NONE 也无法解决问题。
四处寻找后,我终于找到了 workaround/solution。
按照此 link on Ubuntu's launchpad it seems that other people are also experiencing this problem. I followed zabuch's instruction at comment #6 进行操作,现在似乎可以使用了。我同意他的看法,问题可能出在 mod_php/php 本身,而不仅仅是 Ubuntu,因为我在 CentOS 上并且遇到过这个问题。
来自zabuch的评论:
The workaround for the issue is to add this:
libxml_disable_entity_loader(false);
before creating new SoapClient.