downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

SoapClient::__getLastResponseHeaders> <SoapClient::__getLastRequestHeaders
[edit] Last updated: Thu, 20 Jun 2013

view this page in

SoapClient::__getLastResponse

(PHP 5 >= 5.0.1)

SoapClient::__getLastResponseDevuelve la última respuesta SOAP

Descripción

public string SoapClient::__getLastResponse ( void )

Devuelve el XML recibido en la última respuesta SOAP.

Nota:

Esta función solo funciona si el objecto SoapClient fue creado con la opción trace establecida como TRUE.

Parámetros

Esta función no tiene parámetros.

Valores devueltos

La última respuesta SOAP, como cadena XML.

Ejemplos

Ejemplo #1 Ejemplo de SoapClient::__getLastResponse()

<?php
$client 
SoapClient("some.wsdl", array('trace' => 1));
$result $client->SomeFunction();
echo 
"Response:\n" $client->__getLastResponse() . "\n";
?>

Ver también



add a note add a note User Contributed Notes SoapClient::__getLastResponse - [3 notes]
up
0
bshafs at gmail dot com
1 year ago
You don't need to surround SoapClient in a try-catch block.  Just set the "exceptions" option to false, and the SoapFault instance will be returned instead of thrown.
up
0
ceo at l-i-e dot com
7 years ago
D'oh!
That example needs:
$soapClient = new SoapClient($url, array('trace'=>1));
to turn ON tracing in the first place.
up
0
ceo at l-i-e dot com
7 years ago
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

 
show source | credits | sitemap | contact | advertising | mirror sites