From the perldoc on SOAP::Lite you might also try on_fault.
  on_fault()
           This lets you specify a handler for "on_fault" event. The
           default behavior is to die on an transport error and to do
           nothing on other error conditions. You may change this
           behavior globally (see "DEFAULT SETTINGS") or locally,
           for a particular object.
Something like this has worked for me quite well:
# Something to store all the soap errors in - this is useful # if your code calls the soap service in a loop. # our @SOAP_ERRORS = (); .... # Get the current number of soap errors # my $error_count = scalar( @SOAP_ERRORS ); my $service = SOAP::Lite -> on_fault( \&soapGetBad ) -> service('http://server/function.asmx?WSDL'); # If the previous number of errors is the same as the current # number of errors, you know that the above service call did # not cause an error so you can process the results or whatever. # if( scalar( @SOAP_ERRORS ) == $error_count ) { ... } .... sub soapGetBad { my $soap = shift; my $res = shift; if( ref( $res ) ) { chomp( my $err = $res->faultstring ); push( @SOAP_ERRORS, "SOAP FAULT: $err" ); } else { chomp( my $err = $soap->transport->status ); push( @SOAP_ERRORS, "TRANSPORT ERROR: $err" ); } return new SOAP::SOM; }

In reply to Re: Soap::Lite Error Handling by ghoti
in thread Soap::Lite Error Handling by ecuguru

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.