Print this page

Marketing Cloud API - Dump SOAP request and response in PHP

Knowledge Article Number 000212964
Description Follow the steps below to dump SOAP requests and responses in PHP.  These dumped logs will allow for the troubleshooting of API calls.
Resolution 1. Enable Tracing on SOAP Client:
$WSDL =; //Or other stack specific WSDL
$SOAP = new SoapClient($$WSDL, array('trace' => 1));

2. Once the call is made:
To get request
$RESQUEST = $SOAP->__getLastRequest();

To get response
$RESPONSE = $SOAP->__getLastResponse();

3. Dump the $REQUEST and $RESPONSE into appropriate log files or output to a console

promote demote