The service specifies it returns an array of strings in the wsdl, which
is exactly what I get. If I use the proxy method to specify the
endpoint, rather than the wsdl, a SOAP::SOM object is returned, with
which I can check for the occurence of faults. The service I am using
returns entries from a database when queried by id, so produces 'useful'
faults like 'No entry found' for an incorrect ID which should be
communicated to the user. So how do I go about trapping faults when I
use the wsdl?
An example trace output from a query generating a fault looks like this:
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Internal
Date: Thu, 15 Mar 2007 18:45:37 GMT
Client-Date: Thu, 15 Mar 2007 18:45:37 GMT
I checked the list archives, which suggested calling the ws method in an
eval block and checking $@, however $@ doesn't seem to be set. I have
also tried setting the on_fault handler, which is successfully die-ing,
but looking at the trace output suggests this is happening on the 500
response, prior to the soap fault being returned, since the fault this
is missing from the resulting trace output.
Any suggestions as to how to trap these errors?
Dr. James Abbott
Bioinformatics Software Developer
Imperial College, London
The hack I've used is to set a global $last_fault variable in the
on_fault handler. Then undef it before the soap call and check if it's
defined after the call.
--- In email@example.com, James Abbott <j.abbott@...> wrote:
> Hi Folks,
> I'm having trouble trapping soap faults when access a service using
> SOAP::Lite accessed via a wsdl. My client code looks something like: