SOAP-ERROR: Parsing WSDL: Couldn’t load from … : failed to load external entity …

I had written some code using Magento API, it worked fine on my local machine but when I transferred the same code to my linux server I got the following error:

SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://mydomain.com/api/soap/?wsdl=1' : failed to load external entity "http://mydomain.com/api/soap/?wsdl=1"

When I opened the URL ‘http://mydomain.com/api/soap/?wsdl=1’  directlty in my browser, it displayed the wsdl file as expected.

The cause of the error is: PHP SoapServer needs to read the wsdl to know which methods are exposed, but when it tries to access the wsdl using mydomain.com instead of localhost it is not able to do so. So, its some network configuration error.

To confirm the same, connect to your server via SSH and try running the following:

curl http://mydomain.com/api/soap/?wsdl=1

If the above command does not display the wsdl file but gives some error then its a network configuration error.

I was using a Centos server and my problem was solved by adding an entry for the domain in the ‘hosts’ file ‘/etc/hosts’ as follows:

10.112.12.123 mydomain.com

In my case my magento application was on the same server on which I was using the Magento API.

If your Magento code is on one server and you are trying to call the Magneto API from another server then you can check your firewall rules.

Leave a Comment

Back to top