phpmagentosoapwsdlmagento-soap-api

SOAP-ERROR: Parsing WSDL: Couldn't load from ... — SSL misconfiguration?


SoapClient throws this exception whenever WSDL is loaded over HTTPS. However, the WSDL file is available over HTTPS. Both through the browser and through curl on the server hosting the SOAP server itself. Gzip isn't the issue either, nor is the firewall. Software-specific aspects (Magento) have been ruled out as far as possible as well.

What could be reasons that the SOAP application cannot load its own WSDL file, despite the file being available? Are there even any to begin with? Or should I start digging into Magento itself again?

A to me ambiguous HTTP 500 error is sent back, if it's of any relevance.

Thanks in advance!


Solution

  • I finally have my Magento 2 SOAP API working with a development SSL certificate. I found an error in my Apache log that led me to the main problem:

    Uncaught Exception: Warning: SoapServer::SoapServer(): SSL operation failed with code 1. OpenSSL Error messages:\nerror:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed

    Here are the settings that got this all cleared up:

    My endpoint (SOAP) URL uses https.

    My entire magento store uses https (for insecure and secure alike).

    I edited my php.ini file for apache2:

    Original Line: openssl.cafile=

    New Version: openssl.cafile=/my/path/to/dev.crt

    Restart apache, clear Magento caches, and php also caches WSDLs, so running "sudo rm -rf /tmp/wsd-*" was required to see results (geez!).

    If you remember to clear the 3000 different caches after making these changes, you will hopefully have a successful SOAP update with Magento using an unverified development certificate.

    I was eventually able to get to the point where commenting out the openssl.cafile line, clearing the /tmp WSDL cache, and restarting apache would cause the SOAP calls to crash, and redoing it all would make it work again. Safe to say, this was the issue I was encountering.