phpmagentowsdlmagento-soap-api

Magento SOAP-ERROR: Parsing WSDL - by cron


I have an ERP using the magento SOAP API v2 (http://www.example.com/api/v2_soap/?wsdl). Through my local server, crons access every minute the API and synchronize data.

Everything always worked very well until one day just stopped working, firing the error:

Symfony\Component\Debug\Exception\FatalErrorException: SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://www.example.com/api/v2_soap/?wsdl' : failed to load external entity "http://www.example.com/api/v2_soap/?wsdl"

When worked, this error happened a few times an hour, but now it always happens.

My server is a ubuntu 16.04 and use the laravel framework 5.2.

The big problem is that if I access the api in my local server by curl for example, everything works, but with cron stopped working.

I know there are many questions on this subject, but none solved my problem.

Thanks.


Solution

  • Ive faced this before and had to put the host name of the soap server (your Magento machine) in the /etc/hosts file because when making a soap call the server has to be able to resolve itself.