I'm working with soap. when I made a call, I used try {} catch {} block. I want to save the exception errors into database. and in order to beautify the codes I parse the errors to my another function here's the sample:
$paramis = array(
'client' => '225',
'film_id' => '612',
'booking' => '2016-02-28',
'persons' => 1
);
$puri = 'http://www.filmonschedule.com/Portal/break.asmx?WSDL';
$client = new SoapClient($puri, array('trace' => 1, 'exceptions' => 1));
//var_dump($client);
try {
$resp = $client->__soapCall('getFilmToBook', array('parameters' => $paramis));
} catch (Exception $e) {
printErrorMu($e);
}
function printErrorMu($e)
{
print_r($e);
}
this is the output printErrorMu($e)
SoapFault Object
(
[message:protected] => System.Web.Services.Protocols.SoapException: No Schedule
at Portal.Break.getFilmToBook(String portalName, String client, String film_id, String booking, String persons)
[string:Exception:private] =>
[code:protected] => 0
[file:protected] => /var/www/myfilm/test.php
[line:protected] => 245
[trace:Exception:private] => Array
(
[0] => Array
(
[file] => /var/www/myfilm/test.php
[line] => 245
[function] => __soapCall
[class] => SoapClient
[type] => ->
[args] => Array
(
[0] => getFilmToBook
[1] => Array
(
[parameters] => Array
(
[client] => 225
[film_id] => 612
[booking] => 2016-02-28
[persons] => 1
)
)
)
)
)
[previous:Exception:private] =>
[faultstring] => System.Web.Services.Protocols.SoapException: No Schedule
at Portal.Break.getFilmToBook(String portalName, String client, String film_id, String booking, String persons
[faultcode] => soap:Server
[faultactor] => http://www.filmonschedule.com/Portal/break.asmx
[detail] => stdClass Object
(
[exceptionInfo] => No schedule for this booking request
)
)
but I cannot read the parameter as object/array inside function printErrorMu($e). how to convert the parameter as array or as object so I can access these values of property/key ([message:protected][string:Exception:private][code:protected][file:protected][line:protected][trace:Exception:private][previous:Exception:private]) ?
thank you.