Magento API WDSL

For some customers we integrated Microsoft Dynamics with Magento with the Magento Connector for Dynamics Nav by Tinx-IT.

This uses the Magento API and webservices to communicate external applications.

Clear the wsdl cache

SSH: /tmp > rm wsdl-*
$client = new SoapClient('http://somewhere.com/?wsdl', array('cache_wsdl' => WSDL_CACHE_NONE) );

During development or to debug issues it is handy to clear the cache to make sure the right code is used. You can safely delete these files. It also speeds up the API sometimes.

If your wsdl cache is not stored there, check the wsdl location via php_info().

Prevent the wsdl cache

ini_set('soap.wsdl_cache_enabled', '0'); 
ini_set('soap.wsdl_cache_ttl', '0');  
ini_set("soap.wsdl_cache_enabled", WSDL_CACHE_NONE);

If you wish to prevent future caching, add one of these setting to your php.ini

Change wsdl cache location

soap.wsdl_cache_dir

Sets the directory name where the SOAP extension will put cache files. Default string value = /tmp

Change wsdl cache Time To Live

soap.wsdl_cache_ttl

Sets the number of seconds (time to live) that cached files will be used instead of the originals. Default integer = 86400

soap.wsdl_cache

If soap.wsdl_cache_enabled is on, this setting determines the type of caching. This can also be set via the options array in the SoapClient or SoapServer constructor. The integer options are:

  1. WSDL_CACHE_NONE (0)
  2. WSDL_CACHE_DISK (1)
  3. WSDL_CACHE_MEMORY (2)
  4. WSDL_CACHE_BOTH (3)

Change wsdl cache limit

soap.wsdl_cache_limit

Maximum number of in-memory cached WSDL files. Adding further files into a full memory cache will delete the oldest files from it.

addition setting that influence your wsdl

These php.ini settings also affect the behaviour of your soap server and clients :

default_socket_timeout
Large or slow requests to your soap server or long processes at your soap server will return soap fault after 60 secs like : Error Fetching http headers.

max_execution_time default
This can be the next bottleneck (but only when your default_socket_timeout is larger then this setting). Your soap server will not return anything, no faults no output, just an empty string.

memory_limit
Will throw fatal errors when the soap server script itself has low memory or will let your services return empty strings when the data it processes puts memory usage over this limit.


So, what do you think ?