DreamT has asked for the wisdom of the Perl Monks concerning the following question:
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.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 }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: SOAP::Lite and call behaviour
by Anonymous Monk on Mar 13, 2018 at 17:28 UTC |