Hi,
I'm using SOAP::Lite for setting up a soap client:
my $service_status = 1;
my $client = SOAP::Lite
-> uri( $URI )
-> on_action(sub{ qq($on_action) })
-> on_fault(sub { $service_status = 0 })
-> envprefix('soapenv')
-> autotype(0)
-> proxy( $Proxy );
my $method = SOAP::Data->name($method);
my $header = SOAP::Header->type('data'=>SOAP::Data->type('xml' =>
+''));
my $body = _arrayref_to_soap($body);
my $result;
eval
{
$result = $client->call($method,$header,@$body);
};
if ( $@ )
{
# error handling
}
if ( !$service_status )
{
# error handling
}
This works great when the call is successful, the problem is when the web service is responding with an error (for example, when I use the wrong namespace). In that case, $result remains empty, $@ doesn't get set, and $service_status doesn't get set to 0.
This means that I can't collect the error from the web service. Of course, I can evaluate if $result is empty to find out what's wrong, but that doesn't seem correct.
Any ideas? Am I using on_fault the wrong way?