Search code examples
phpmagentosoapwsdlmagento-soap-api

Soap error when trying to use the API of Magento


I am looking for help with this problem and I hope someone give me that help. The error is the following:

Fatal error: SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://example.com/index.php/api/?wsdl' : failed to load external entity "http://example.com/index.php/api/?wsdl" in /var/www/presentacion/app/code/local/Pengo/Extension/Model/Something.php on line 28

And the code that I'm using to connect to it is something like this:

$this->_soap = new SoapClient(http://example.com/index.php/api/?wsdl);

and there is where it says is the error.

I have been serching in Google, PHP forums, here in StackOverflow and Magento itself but I don't find the solution anywhere.

What I had seen is that the WSDL is never get parsed or loaded as the error says and none of its functions.

I tried connecting like this:

$options['location'] = http://example.com/index.php/api/?wsdl;
$options['uri'] = 'urn:Magento';
$this->_soap = new SoapClient(null, $options);

like this it doesn't dispatch any error like the others but there aren't functions to use, like in the other case it doesnt' load and parse the WSDL.

I am a bit frustrated because I have been developing this like 1 month and now that I am making some tests it shows this message, I had test it when it was really empty and new and it worked fine.

So any help would be appreciated.

Thank you.


Solution

  • Well after all the things that I test the only one that worked for me, I don't know why but it worked, was doing this in two separate machines. I tried that because I read that somewhere and I just do it and my Magento and Webservice now works perfectly. Whenever I try to do this local it dispatch the same error.

    I hope this can help someone in the future and they don't have to knock their head on the wall because of this problem.

    Thank you all for your answers and comments.