W3docs

How do I see the actual XML generated by PHP SOAP Client Class?

To see the actual XML generated by the PHP SOAP Client class, you can use the __getLastRequest() method.

To see the actual XML generated by the PHP SOAP Client class, you can use the __getLastRequest() method. This method returns the last SOAP request sent by the client in XML format.

Here is an example:

Example of seeing the actual XML generated by the PHP SOAP Client class

<?php

$client = new SoapClient('some.wsdl', ['trace' => true]);
$client->someMethod();
echo $client->__getLastRequest();

Note: The trace option must be set to true when instantiating the SoapClient for __getLastRequest() to capture and return the request XML.

This will output the XML of the last SOAP request sent by the client.