Problem with soap trace if error
| From: | Andy Cress | Date: | Tue, 22 Apr 2014 15:44:05 +0000 |
| Subject: | Problem with soap trace if error | ||
| Groups: | php.soap | ||
| Request: | Send a blank email to php-soap+get-3400@lists.php.net to get a copy of this message | ||
I am using CentOS6.4 with these versions of php:
php-5.3.3-27.el6_5.x86_64
php-soap-5.3.3-27.el6_5.x86_64
When I turn on the trace for my soap calls, it only returns data if the call succeeds, but the
output if empty if it gets an error/exception.
Here is what I'm doing below, perhaps there is something I am missing?
$client = getSoapClient ($wsdl);
try {
$response = $client->__soapCall('AddServiceTicketViaCompanyId',
array($serviceTicketViaCompanyId),
array('uri' => 'http://connectwise.com', 'soapaction' =>
''));
if ( $debugxml ) { // works fine here
fwrite($logHandle, "AddServiceTicket Headers:\n".
$client->__getLastRequestHeaders()."\n");
fwrite($logHandle, "AddServiceTicket Request:\n".
$client->__getLastRequest()."\n");
}
}catch (SoapFault $fault){
if ( $debugxml ) { // both headers and request return empty here
fwrite($logHandle, "AddServiceTicket Error Headers:\n".
$client->__getLastRequestHeaders()."\n");
fwrite($logHandle, "AddServiceTicket Error Request:\n".
$client->__getLastRequest()."\n");
}
throw new Exception($fault->getMessage());
}
where
function getSoapClient ( $wsdl ){
[...]
if ($trace == 0) {
$newclient = @new SoapClient($wsdl);
} else {
$newclient = @new SoapClient($wsdl, array('trace' => 1));
}
return $newclient;
[...]
}