SOAP - unable to invoke since upgrade to 1.9.3.1 (timeout), how to debug?
-
04-10-2020 - |
문제
I've recently upgraded a Magento installation from 1.9.0.1 to 1.9.3.1. Ever since, the various apps I use to communicate with Magento via SOAPv2 have timed out with error 504.
When I attempt to load the WSDL in .NET WebService Studio I can see a complete listing of all the services, but when I attempt to invoke any of the services the process times out.
I've attempted using the SOAPv1 API and I'm getting exactly the same issue.
I've also tried installed a completely fresh copy of Magento, and the result is exactly the same; WSDL loads but times out when any invoke is attempted. The only log I can find which is even vaguely helpful is PHP-FPM's slow process log, which reveals this trace:
SoapServer() /web-root/lib/Zend/Soap/Server.php:814
_getSoap() /web-root/lib/Zend/Soap/Server.php:880
handle() /web-root/app/code/core/Mage/Api/Model/Server/V2/Adapter/S$
run() /web-root/app/code/core/Mage/Api/Model/Server.php:138
run() /web-root/app/code/core/Mage/Api/controllers/V2/SoapControlle$
indexAction() /web-root/app/code/core/Mage/Core/Controller/Varien/A$
dispatch() /web-root/var/cache/ew/files/69/b9/Mage/Core/Controller/$
match() /web-root/app/code/core/Mage/Core/Controller/Varien/Front.p$
dispatch() /web-root/app/code/core/Mage/Core/Model/App.php:365
run() /web-root/app/Mage.php:684
run() /web-root/index.php:116
How can I debug what the problem might be?
What might have changed between 1.9.0.1 and 1.9.3.1 which would clash with the server?
해결책
It was caused by 500 errors as a result of duplicate headers.
The fix is detailed here: http://www.magegyver.de/duplicate-content-type-header-on-api-responses/
To get things working I copied
app/code/core/Mage/Api/Model/Server/V2/Adapter/Soap.php
to
app/code/local/Mage/Api/Model/Server/V2/Adapter/Soap.php
and edited lines 62 and 85 from:
->setHeader('Content-Type', 'text/xml; charset=' . $apiConfigCharset)
to:
->setHeader('Content-Type', 'text/xml; charset=' . $apiConfigCharset, true)