Search code examples
phpsoapmantis

MantisConnect.php Error - Couldn't load from 'http://www.mantisbt.org/demo/api/soap/mantisconnect.php' : failed to load external entity


I am trying to get the status of issues from Mantis. Having search through other posts here, people indicate that the web service on their site should be working. However I get the error when attempting this. Openssl, SOAP, curl, etc... are all enabled in my PHP (5.4.26).

Sample code: (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));
...
?>

Internal Site, which has MantisConnect installed that gets 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));
...
?>

I get an exception on the SoapClient call:

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"

Going to the web address in my browser does show me the output for Mantis connect.


Solution

  • Original code posting had a space before the http:// which caused the problem. Changing the code to remove the space fixed the error.

    $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));
    ...