$client = new SoapClient("http://example.com/service.wsdl", array('trace'=>1)); $client->someMethod(); // retrieve last XML request message $request = $client->__getLastRequest(); // output request message echo $request;
$options = array( 'location' => 'http://example.com/service.php', 'uri' => 'http://example.com/service', 'trace' => 1 ); $client = new SoapClient(null, $options); $client->someMethod(); // retrieve last XML request message $request = $client->__getLastRequest(); // output request message echo $request;This example sets up a `SoapClient` instance using the `location` and `uri` options to specify the location of the SOAP server. The `trace` option is set to `true` to enable message tracing. The `__getLastRequest` method is used to retrieve the XML request message sent by the client. Package library: PHP Soap Extension.