0

I am using Mantis Bug Tracker SOAP API, but unfortunately every time it returns to me message like

"looks like we got no XML document",

after tracing the last response I got following message

"<?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>"

I hope that, I am getting xml respose back, it appears that there is a addition of "" characters in the beginning.

Any clue or help would be great, in removing those characters.

The code for connecting to MANTIS SOAP API SERVER

<?php
    $c = new \SoapClient("http://dev06/api/soap/mantisconnect.php?wsdl", array('trace'=> true, 'encoding'=>' UTF-8', 'soap_version'=>1.2));
    $username = "xxxxx";
    $password = "xxxxx";
    try {
        $c->mc_issue_get(trim($username), trim($password), 2331);
    } catch (SoapFault $exception) {
        var_dump($c->__getLastResponse());
    }
    ?>
bharatesh
  • 952
  • 2
  • 11
  • 23
  • Please provide more information such as Mantis version and the source code which connects to mantis. – libregeek Feb 07 '14 at 05:10
  • Hi Thanks for your reply. I am using latest version of Mantis ‎1.2.15. Please find above the code that connects to mantis SOAP api server. – bharatesh Feb 07 '14 at 08:24

2 Answers2

0

I don't see any issue with your code and it works perfectly in my environment with slight modifications:

$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());
    }

It could be the soap_version, so may be you could try with soap_version=SOAP_1_1

libregeek
  • 1,264
  • 11
  • 23
0

Oh...!

Finally got the solution for it. Its very simple.

Firstly mantis SOAP API code base contains may be more than 20,000 lines of code. I think there is some where some one is printing some BOM characters.

So best solution would be, just use following function,

ob_clean();

This function must be used in

/library/nusoap/nusoap.php

Because this file has

send_response()

That printouts payload, So just use ob_clean() at the beginning of the send_response() function.

Thanks and hope it will help others.

bharatesh
  • 952
  • 2
  • 11
  • 23