Skip to search.

Breaking News Visit Yahoo! News for the latest.

×Close this window

soaplite · SOAP::Lite for Perl (soaplite.com)

The Yahoo! Groups Product Blog

Check it out!

Group Information

  • Members: 1205
  • Category: Protocols
  • Founded: Jan 28, 2001
  • Language: English
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

Messages

Advanced
Messages Help
trapping soap faults when using a wsdl   Topic List   < Prev Topic  |  Next Topic >
Summarize Messages Sort by Date  
#5914 From: James Abbott <j.abbott@...>
Date: Thu Mar 15, 2007 6:53 pm
Subject: trapping soap faults when using a wsdl
j.abbott@...
Send Email Send Email
 
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:

my $wsdl = 'http://address/of/service.wsdl';
my $soap = new SOAP::Lite->service($wsdl);
my $r =$soap->method(args);

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::Response=HASH(0x8691ef8)
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Internal
Server Error
Connection: close
Date: Thu, 15 Mar 2007 18:45:37 GMT
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=utf-8
Client-Date: Thu, 15 Mar 2007 18:45:37 GMT
Client-Peer: xxx.xx.xx.xx:80
Client-Response-Num: 1
Client-Transfer-Encoding: chunked

<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><soapenv:Fau\
lt><faultcode>soapenv:Server.userException</faultcode><faultstring>uk.ac.ebi.jdb\
fetch.exceptions.DbfNoEntryFoundException:
No result found</faultstring><detail><ns1:hostname
xmlns:ns1="http://xml.apache.org/axis/">tomcat-1.ebi.ac.uk</ns1:hostname></detai\
l></soapenv:Fault></soapenv:Body></soapenv:Envelope>


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?

Thanks,
James

--
Dr. James Abbott
Bioinformatics Software Developer
Imperial College, London




#5965 From: "nicholas_toze" <nicholas_toze@...>
Date: Wed Jun 6, 2007 5:16 pm
Subject: Re: trapping soap faults when using a wsdl
nicholas_toze
Send Email Send Email
 
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 soaplite@yahoogroups.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:
>




 
Add to My Yahoo!      XML What's This?

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines NEW - Help