D'oh!
That example needs:
$soapClient = new SoapClient($url, array('trace'=>1));
to turn ON tracing in the first place.
SoapClient::__getLastResponse
(PHP 5 >= 5.0.1)
SoapClient::__getLastResponse — Retourne la dernière réponse SOAP
Description
public string SoapClient::__getLastResponse
( void
)
Retourne le code XML la dernière réponse SOAP.
Note: Cette fonction n'est disponible que si l'objet SoapClient a été créé avec l'option trace à TRUE
Liste de paramètres
Cette fonction ne contient aucun paramètre.
Valeurs de retour
La dernière réponse SOAP, sous forme de chaîne XML.
Exemples
Exemple #1 Exemple avec SoapClient::__getLastResponse()
<?php
$client = SoapClient("some.wsdl", array('trace' => 1));
$result = $client->SomeFunction();
echo "Response:\n" . $client->__getLastResponse() . "\n";
?>
Voir aussi
- SoapClient::__getLastResponseHeaders - Retourne les entêtes de la dernière réponse SOAP
- SoapClient::__getLastRequest - Retourne la dernière requête SOAP
- SoapClient::__getLastRequestHeaders - Retourne les entêtes de la dernière requête SOAP
SoapClient::__getLastResponse
ceo at l-i-e dot com
04-Jan-2006 09:31
04-Jan-2006 09:31
ceo at l-i-e dot com
04-Jan-2006 09:30
04-Jan-2006 09:30
You almost for sure will need to wrap a try/catch block around your SOAP call in order to use these to debug something that's not working.
Otherwise, PHP throws a fatal error before you can execute this function.
For example:
<?php
$soapClient = new SoapClient($url);
echo htmlentities($soapClient->__getFunctions());
//Assume that has output 'someFunction' (among others)
try {
$results = $soapClient->someFunction(...);
}
catch (SoapFault $soapFault) {
var_dump($soapFault);
echo "Request :<br>", htmlentities($soapClient->__getLastRequest()), "<br>";
echo "Response :<br>", htmlentities($soapClient->__getLastResponse()), "<br>";
}
?>
Without try/catch, your just get the Fatal Error and PHP commits suicide before you can call __getLastRequest/__getLastResponse
