SOAP error: Parsing WSDL: Couldn’t load from “”: failed to load external entity

in Troubleshooting

Magento’s SOAP API references its own WSDL, making the magento instance depend on its own api endpoint.
If it’s not possible to connect to the SOAP API from the hypernode, you’ll get this error when trying to perform requests.

Hypernodes are configured to support http requests from the server itself without the need to add your domain to the /etc/hosts as suggested in many articles online.
If you get this error, some configuration or error is with withholding the Magento installation to connect to it’s own API endpoint.

Magento constructs the WSDL URL based on your Magento instance base URL. This means that if your Magento store is not accessible from the the server itself, SOAP server will not be able to load WSDL during initialisation. As a result you encounter this error.

Test if your SOAP API is available for Magento

To verify if it is possible to connect to the magento API, you can use curl:

SITE="example.com"
curl -v https://$SITE/index.php/api/index/index/wsdl/1/

This should return the XML schema:

<definitions xmlns:typens="urn:Magento" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" name="Magento" targetNamespace="urn:Magento">
    <types>
        <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Magento">
            <import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemaLocation="http://schemas.xmlsoap.org/soap/encoding/"/

If you’re not able to curl for the WSDL, chances are high this may be the issue.

Troubleshooting

Check if the useragent of the soapclient is ratelimitted

If the source ip of the soap client is ratelimitted, find the corresponding ratelimit zone in /var/log/nginx/access.log and add the useragent to the useragent mapping or the ip ratelimit whitelist.

if the ip of the server is allowed to make http requests

If you are using a white and or blacklist to allow and deny ip’s, make sure the ip of the node itself and the localhost ip (127.0.0.1) are both present in the

Flush your WSDL cache

In some cases the wsdl cache file in /tmp/ is corrupted, causing the same error.
If you run into this issue, use the following workaround to recache your wsdl file:

rm /tmp/wsdl*
n98-magerun cache:flush

2