1

When I try to connect to magenento api through soap with this code:

//soap call test
    $client = new SoapClient('https://magentohost/api/soap/?wsdl');

// If somestuff requires API authentication,
// then get a session token
$session = $client->login('user', 'key');

$result = $client->call($session, 'catalog_product.info', '930569');
var_dump($result);

//If you don't need the session anymore
$client->endSession($session);

I get this error:

Got error 'PHP message: PHP Fatal error: SOAP-ERROR: Parsing WSDL: Couldn't load from <URL>  : Extra content at the end of the document

Everything is enable the user and role, I cannot figure out what is the problem.

0

The "Extra content at the end of the document" error usually comes from your ?wsdl page being unaccessible and being redirect to the home page which results in the SoapClient class trying to load the home page HTML as XML and failing.

First try accessing the wsdl url using your browser (on the same machine you're running your api script from) to see if it actually returns the wsdl file.

Your url might be unaccessable due to ip whitelisting issues or wrong hostfile setup.

  • I disabled the redirecting action but it shows the same error. The structure of the xml file is fine, The url is accessible. – blob Mar 14 at 8:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.