how to save API xml request and response files
-
13-12-2019 - |
Question
I want to save magento customer(or other module) API(V1,V2) request and response XML files. for this i have found usefule [link][http://www.techytalk.info/magento-extension-for-logging-soap-v1-and-v2-api-requests/]1, it uses
public function call($sessionId, $apiPath, $args = array())
{
Mage::helper('inchoo_soaplogger/v1')
->logPostXml();
return parent::call($sessionId, $apiPath, $args);
}
With this i can save request xml file, but i could not achieve response xml file, we do not have method callResponse
to call from parent.
Please help me on how to save both response and request API XML files.
Solution
All the SOAP cals go through the method Mage_Api_Model_Server_Adapter_Soap::run
there is an if-else statement in there. The if
branch generates the WSDL, you don't need to log that.
On the else
branch you get the response as XML from the line $this->_soap->handle()
.
Log that response.
For the xmlrpc calls everything passes through Mage_Api_Model_Server_Adapter_Xmlrpc::run
.
And the response is generated by the code $this->_xmlRpc->handle()
.