Loading ...
Sorry, an error occurred while loading the content.

6630When is a fault not a fault?

Expand Messages
  • BC
    Jul 8, 2013
      Under certain circumstances SOAP::Lite is receiving valuable
      fault information from the server, but I can't figure out how to
      cleanly retrieve it. Consider the following example.

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

      use warnings;
      use strict;
      use SOAP::Lite;

      my $sObj = SOAP::Lite->new(uri => $NAME_SPACE, proxy => $END_POINT );
      my $rObj;
      eval
      {
      $rObj = $sObj->fooBar(); # line 29
      };

      warn("? $0: no SOAP::SOM object returned\n_ ") # line 32
      if (not defined($rObj));

      if ($@) # the eval didn't go well.
      {
      warn($sObj->transport->http_response->content()); # line 37
      warn("? $0: $@");
      warn("? $0: ", $sObj->transport->status(), "\n_ "); # line 39
      warn("? $0: ", $sObj->faultstring(), "\n_ "); # line 40
      }

      warn(" $0: reached end-of-script\n_ "); # line 43

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

      When we run this we get the following output:

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

      ? ./demo4: no SOAP::SOM object returned
      _ at ./demo4 line 32.
      <?xml version='1.0' ...<faultstring>Cannot find dispatch method ...
      at ./demo4 line 37.
      ? ./demo4: 500 Internal Server Error at ./demo4 line 29
      ? ./demo4: 500 Internal Server Error
      _ at ./demo4 line 39.
      500 Internal Server Error at ./demo4 line 40

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

      So this appears as if this is being treated as a transport error,
      unhelpfully reported as an "Internal Server Error", but there is
      a SOAP message that was returned in the response with the very
      helpful message:

      Cannot find dispatch method for {https://whatever}fooBar

      So I don't understand, using SOAP::Lite methods, how I should be
      capturing this return result.

      Here's an edited version of the return envelope...

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

      <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
      <S:Header>
      <work:WorkContext xmlns:work="http://oracle.com/weblogic/soap/workarea/">
      rO...AAA
      </work:WorkContext>
      </S:Header>
      <S:Body>
      <S:Fault xmlns:ns4="http://www.w3.org/2003/05/soap-envelope">
      <faultcode>S:Client</faultcode>
      <faultstring>Cannot find dispatch method for
      {https://whatever/identity}fooBar
      </faultstring>
      </S:Fault>
      </S:Body>
      </S:Envelope>

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

      ...BC
    • Show all 7 messages in this topic