Menu

#32 no public method for getting fault string

closed-duplicate
Misc/Other (17)
5
2007-10-03
2003-07-14
Anonymous
No

If using service method, then in case of fault (500 http
code), there is no public method to get fault details.
The reason is that SOAP::Lite::call method deliberately
returns undef (return value of "paramsall" method):

defined $self->fault ? return : return $self->valueof
($results{$method});

Here is the place where paramsall is being invoked.
Below is debugging output showing that $som object
has fault details inside. Unfortunately, this $som
object is being lost which needs to be fixed.

my $som = $self
-> endpoint($method{endpoint})
-> uri($method{uri})
-> on_action(sub{qq!"$method{soapaction}"!})
-> call($method => map {@templates ? shift
(@templates)->value($_) : $_} @_);
UNIVERSAL::isa($som => 'SOAP::SOM') ? wantarray ?
$som->paramsall : $som->result
: $som;

DB<7> p UNIVERSAL::isa($som => 'SOAP::SOM')
1
DB<8> p wantarray
1
DB<9> x $som->paramsall
empty array
DB<10> x $som->result
empty array
DB<11> x $som->fault
0 HASH(0x7cc190)
'faultcode' => 'soapenv:Server.generalException'
'faultstring' => "[org.apache.axis.AxisFault : ; nested
exception is: \cJ\cIorg.xml.sax.SAXException: Bad ty
pes (class [Ljava.lang.Object; -> interface
java.util.Map)]; nested exception is:
\cJ\cIcoldfusion.xml.rpc.CFCI
nvocationException: [org.apache.axis.AxisFault : ;
nested exception is: \cJ\cIorg.xml.sax.SAXException:
Bad typ
es (class [Ljava.lang.Object; -> interface java.util.Map)]"
DB<12>

*$method = sub {
my $self = shift;
ref $self or return $results{$method};
Carp::croak "Method '$method' is readonly and
doesn't accept any parameters" if @_;
defined $self->fault ? return : return $self->valueof
($results{$method});
};

Discussion

  • Nobody/Anonymous

    Logged In: NO

    Fault details are not actually lost, but it is really hard to
    retrieve them:

    $faultstring =
    $soap->{_call}{_content}[2][0][2][0][4]{'faultstring'};

     
  • Byrne Reese

    Byrne Reese - 2004-01-11

    Logged In: YES
    user_id=28043

    I was unable to reproduce this bug. I used the following
    script, derived from the code posted above. I sent a message
    to a service that always errors, but I easily had access to
    the faultstring.

    ------------------------

    #!/usr/bin/perl

    use SOAP::Lite;

    $URI = 'http://localhost/cgi-bin/soaplite.cgi';

    my $som = SOAP::Lite
    ->proxy($URI)
    ->uri("urn:TemperatureService")
    ->call('alwaysFault' => "");

    UNIVERSAL::isa($som => 'SOAP::SOM') ? wantarray ?
    $som->paramsall : $som->result
    : $som;

    print "faultstring:".$som->faultstring."\n";

     
  • Byrne Reese

    Byrne Reese - 2004-01-11
    • milestone: 250889 -->
    • status: open --> open-works-for-me
     
  • Martin Kutter

    Martin Kutter - 2007-10-03
    • status: open-works-for-me --> closed-duplicate
     
  • Martin Kutter

    Martin Kutter - 2007-10-03

    Logged In: YES
    user_id=884175
    Originator: NO

    The error described does not appear on 500 Internal Server Error, but on connection close.
    Duplicate of [ 1025355 ] Returns undef on HTTP connection close

     

Log in to post a comment.