Search code examples
performancemagentomagento-soap-api

Magento SOAP v1 vs. v2 performance


I am in the process of using VB.NET to work with the Magento API. I was using SOAP v1 successfully until I ran into a call that needs an associative array. After a day or so of no luck I decided to try v2 which has all the objects I need. v2 works but is very, very slow. To update one stock item inventory it took roughly a minute and a half to login and do the update as opposed to maybe less than 10 seconds with v1. That reminded me why I chose v1 in the first place.

My question is if there is anyway to improve the performance on v2. I can't imagine there is to the extent I need it but I thought I'd ask. I already have caching enabled. The alternative of getting v1 to accept an associative array seems to be a challenge, if possible.


Solution

  • There's lots of reasons a WSDL request might be taking a long time, but the first thing I'd check is the settings for the WSDL cache. When you make an API call into Magento, Magento uses PHP's SoapServer object. The SoapServer object needs to fetch its own WSDL file to operate, and the generation and fetching of this file can be a time consuming thing.

    Go to

    System -> Configuration -> Magento Core API -> General Settings
    

    and look for "Enable WSDL Cache". Set this to yes and you'll see some API performance improvement.

    This setting may not exist in your version of Magento — if that's the case you might be interested in the Mercury API extension, (created and sold by me) with API improvements that include this functionality for older versions of Magento. If you don't have budget for an extension, Mage_Api_Model_Server_Adapter_Soap is the class where older versions of Magento disable this cache.