Magento – Fault Object looks like we got no XML document

ee-1.13.1.0errormagento-enterprisesoapwsdl

I'm using the script below to connect to the Magento API. When trying to connect with my script I've got:

SOAP Fault: (faultcode: Client faultstring: looks like we got no XML document)

If I enter the URL in my browser https://foo.com/api/v2_soap/?wsdl , I've received the default XML file.

I have created a soap user and role. Resource Access = All

Script:

$url = 'https://foo.com/api/v2_soap/?wsdl';

$client = new SoapClient($url);

try {
    //retreive session id from login
    $session_id = $client->login('username','password');
} catch (SoapFault $fault) {
    $error      =   "SOAP Fault: (faultcode: {$fault->faultcode}\n" ."faultstring: {$fault->faultstring})";
    echo $error;
}

Php version 5.4.17.1

Magento version Enterprise 1.13.1.0

Best Answer

Your WSDL XML might be erroneous/not valid.

After a quick Google I found this answer on StackOverflow: https://stackoverflow.com/a/12319009/1306684

I says there might be other output than the XML only. If you open the URL in your browser, then scroll all the way down to see if there is other output (like a PHP error).

If you open the WSDL in your browser, then you see something that looks like a pretty long and solid WSDL XML, but you cannot tell by sight if it is valid.

Try to validate it. You can just Google for a online WSDL validator.

Also do not forget to look for errors in your Magento's logs, check var/system.log and var/exception.log

Related Topic