我正试图从Mantis获得问题的状态。通过这里的其他帖子搜索,人们表示他们网站上的web服务应该是工作的。然而,我得到错误时,尝试这一点。Openssl, SOAP, curl等等…在我的PHP(5.4.26)中,
示例代码:(External Mantis works)
<?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,得到Exception.
<?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"
在我的浏览器中访问web地址确实显示了Mantis connect的输出
原来的代码张贴有一个空格前的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));
...