Debugging PHP SoapClient

When working with SOAP Web Services, it’s sometimes handy to see the raw SOAP request sent by the client and the raw SOAP response received from the server. This makes debugging your SOAP server or SOAP client that much easier.


One option is to install Wireshark, a network protocol analyzer for Unix and Windows.

SoapClient Trace Option

When you’re using PHP SoapClient, it’s easy to see what the raw SOAP request and raw SOAP response looks like. Just use the following functions :

But, to make these functions work, you do have to create your SoapClient object with the trace option turned on :

$client = new SoapClient($wsdlUrl, array('trace' => 1));

One thought on “Debugging PHP SoapClient”

Leave a Reply

Your email address will not be published. Required fields are marked *