我正试图从Mantis那里获得问题的状态。在此处搜索其他帖子后,人们会指出其网站上的网络服务应该正常运行。但是我在尝试这个时遇到错误。 Openssl,SOAP,curl等...都在我的PHP(5.4.26)中启用。
示例代码:(外部Mantis工作)
<?php
$SoapWSDLAddress = 'http://www.mantisbt.org/demo/api/soap/mantisconnect.php?wsdl';
$Client = new SoapClient($SoapWSDLAddress, array('trace' => true, 'encoding' => 'UTF-8', 'soap_version' =>SOAP_1_2));
...
?>
内部站点,安装了MantisConnect,可获得异常。
<?php
$SoapWSDLAddress = 'http://192.168.0.1/mantis/api/soap/mantisconnect.php?wsdl';
$Client = new SoapClient($SoapWSDLAddress, array('trace' => true, 'encoding' => 'UTF-8', 'soap_version' =>SOAP_1_2));
...
?>
我在SoapClient调用上遇到异常:
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from ' http://192.168.0.1/mantis/api/soap/mantisconnect.php?wsdl' : failed to load external entity "http://192.168.0.1/mantis/api/soap/mantisconnect.php?wsdl"
在我的浏览器中访问网址确实向我显示了Mantis connect的输出。
答案 0 :(得分:0)
原始代码发布在http://之前有一个空格,这导致了问题。更改代码以删除空格可修复错误。
$SoapWSDLAddress = 'http://www.mantisbt.org/demo/api/soap/mantisconnect.php?wsdl';
$Client = new SoapClient($SoapWSDLAddress, array('trace' => true, 'encoding' => 'UTF-8', 'soap_version' =>SOAP_1_2));
...