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

search for in the

SoapClient->__getLastResponseHeaders> <SoapClient->__getLastRequestHeaders
Last updated: Fri, 01 Aug 2008

view this page in

SoapClient->__getLastResponse

(No version information available, might be only in CVS)

SoapClient->__getLastResponse Returns last SOAP response.

Descripción

SoapClient
string __getLastResponse ( void )

Note: This method works only if the SoapClient object was created with the trace option.

Valores retornados

The last SOAP response.

Ejemplos

Example #1 SoapClient->__getLastResponse() example

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



add a note add a note User Contributed Notes
SoapClient->__getLastResponse
ceo at l-i-e dot com
04-Jan-2006 10:31
D'oh!
That example needs:
$soapClient = new SoapClient($url, array('trace'=>1));
to turn ON tracing in the first place.
ceo at l-i-e dot com
04-Jan-2006 10: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

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