SOAP::Lite services fault processing
am 07.03.2007 18:22:18 von jahhajI've set up a service which deliberately errors. If I access the
service like this
my $res = SOAP::Lite
->uri( ... )
->proxy( ... )
->mol2cxf($mol);
if ($res->fault)
{
print "fault\n";
print "code ", $res->faultcode, "\n";
print "string ", $res->faultstring, "\n";
print "actor ", $res->faultactor, "\n";
}
Then everything works, I see the error message.
But if I try to access through a .wsdl file like this
my $res = SOAP::Lite
->service( ... )
->mol2cxf($mol);
if ($res->fault)
{
}
Then I get a Perl error message 'Can't call method "fault" on an
undefined value ...'
Searching on the internet I've seen a couple of posts which agree this
doesn't work and suggest this instead
my $service = SOAP::Lite->service( ... );
my $res = $service->mol2cxf($mol);
if ($service->call->fault)
{
}
There's even an example in the SOAP::Lite module that does the same
thing. However it doesn't work for me. Turning on trace, it seems that
$service->call->fault makes another call to the service, which then
errors.
I've also tried using on_fault. Again I have the same result,
everything works as expected when I use uri() and proxy() but not when
I use service(). I'm beginning to think that there is no way to get
error information when using service(). Searching the internet I see
I'm not the only person with this problem. Does anyone know how this
is supposed to work?
I should also add then when I'm not causing deliberate errors in my
service, everything works correctly whichever method I'm using to
access my service.
The service was written using GSOAP, I'm only using Perl as the
client. I'm using SOAP::Lite 0.69.
Thanks in advance.