I need to debug some code which uses soap client. I found getLast* methods in php.net, but when I try to get last request for debug it returns NULL
<?php
$client = new SoapClient("http://www.webservicex.net/ConverPower.asmx?WSDL");
$response = $client->ChangePowerUnit(array(
"PowerValue" => 100,
"fromPowerUnit" => "horsepower",
"toPowerUnit" => "megawatts"
));
echo "====== REQUEST HEADERS =====" . PHP_EOL;
var_dump($client->__getLastRequestHeaders());
echo "========= REQUEST ==========" . PHP_EOL;
var_dump($client->__getLastRequest());
echo "========= RESPONSE =========" . PHP_EOL;
var_dump($response);
?>
The result of code execution:
$php soap_test.php
====== REQUEST HEADERS =====
NULL
========= REQUEST ==========
NULL
========= RESPONSE =========
object(stdClass)#2 (1) {
["ChangePowerUnitResult"]=>
float(0.0746)
}
How to get the content of body and headers of the last SoapClient request?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…