螳螂Bug跟踪器SOAP API响应XML错误
我使用的是螳螂Bug跟踪器SOAP API,但不幸的是,每次它都会像这样返回消息 “螳螂Bug跟踪器SOAP API响应XML错误,soap,response,mantis,Soap,Response,Mantis,我使用的是螳螂Bug跟踪器SOAP API,但不幸的是,每次它都会像这样返回消息 “看起来我们没有XML文档”” 在跟踪最后一个响应之后,我得到了以下消息 "<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://sc
看起来我们没有XML文档”
”
在跟踪最后一个响应之后,我得到了以下消息
"<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body><SOAP-ENV:Fault><faultcode xsi:type="xsd:string">Client</faultcode><faultactor xsi:type="xsd:string"></faultactor><faultstring xsi:type="xsd:string">Issue does not exist.</faultstring><detail xsi:type="xsd:string"></detail></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>"
我看不出您的代码有任何问题,它在我的环境中运行良好,只需稍作修改:
$c = new \SoapClient("http://localhost/demo/mantisbt-1.2.15/api/soap/mantisconnect.php?wsdl", array('trace'=> true, 'encoding'=>' UTF-8', 'soap_version'=>SOAP_1_2));
$username = "XXXXXXXX";
$password = "XXXX";
try {
$issue = $c->mc_issue_get(trim($username), trim($password), 31);
var_dump($issue);
} catch (SoapFault $exception) {
var_dump($c->__getLastResponse());
}
它可能是soap\u版本,因此您可以尝试使用soap\u version=soap\u 1\u 1哦
终于找到了解决办法。这很简单
首先,MantisSOAPAPI代码库包含的代码可能超过20000行。我认为有些地方有人正在打印一些BOM字符
所以最好的解决方案是,只需使用以下函数
ob_clean();
此函数必须在中使用
/library/nusoap/nusoap.php
因为这个文件
send\u response()
这是打印输出的有效负载,所以只需在send_response()函数的开头使用ob_clean()
谢谢,希望它能帮助别人 请提供更多信息,如螳螂版本和连接到螳螂的源代码。您好,谢谢您的回复。我用的是最新版本的螳螂1.2.15. 请在上面找到连接到MantisSOAPAPI服务器的代码。谢谢回复。无论如何,我还是遇到了同样的问题。它与客户端设置有关。客户端设置是什么意思?可能是浏览器设置?
/library/nusoap/nusoap.php