SOAP error: Parsing WSDL: Couldn't load from "" failed to load external entity

SOAP server needs to be initialized with WSDL to understand how to process incoming requests (it basically loads WSDL from the specified URL in case of Magento). This happens in \Mage_Api_Model_Server_Adapter_Soap::_instantiateServer():

$this->_soap = new Zend_Soap_Server(
    $this->getWsdlUrl(array("wsdl" => 1)),
    array('encoding' => $apiConfigCharset)
);

Note that getWsdlUrl() constructs WSDL URL based on your Magento instance base URL. It means that if your Magento store is not accessible from the the host where it is deployed, SOAP server will not be able to load WSDL during initialization. As a result you would encounter such error when trying to perform requests to Magento SOAP API.


I was experiencing the same issue. I did install the orocrm bridge which needs to access the soap api, followed the given steps to configure a soap role and a user and then I tried to connect: Parameters are not valid!

After digging in the logs, I did notice this error:

[2017-07-03 16:57:46] app.CRITICAL: MageCheck 
error: 0:  [message]           
SOAP-ERROR: Parsing WSDL: Couldn't load from 
'https://my.magento.store/index.php/api/v2_soap/index/?wsdl=1' : 
failed to load external entity 
"https://my.magento.store/index.php/api/v2_soap/index/?wsdl=1"

[request]
<?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:Magento" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
        <SOAP-ENV:Body>
            <ns1:login>
                <username xsi:type="xsd:string">orocrm</username>
                <apiKey xsi:type="xsd:string">***</apiKey>
            </ns1:login>
        </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>

[response]
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Body>
        <SOAP-ENV:Fault>
            <faultcode>WSDL</faultcode>
            <faultstring>
SOAP-ERROR: Parsing WSDL: Couldn't load from  'https://my.magento.store/index.php/api/v2_soap/index/?wsdl=1' : 
failed to load external entity "https://my.magento.store/index.php/api/v2_soap/index/?wsdl=1"
            </faultstring>
        </SOAP-ENV:Fault>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

[code]              500   [] []

I figured out why I experienced this issue. Actually, this wasn't related to orocrm but to magento. That was a firewall issue. Actually, I did add correctly the rules to allow the crm server to attack the magento api but this one needs to reach out itself ! So after some headaches, I just add a rule on the magento server's firewall to allow itself (the magento server) to reach its own api (kind of external lookup)...

Anyway, I hope this will save some hours to someone