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

Incorrect error handling ?

Expand Messages
  • doevincent
    hi, I have a SOAP-client that looks like this : #!/usr/bin/perl -w use SOAP::Lite +trace = [qw(method trace fault)]; sub
    Message 1 of 2 , Aug 21, 2004
    • 0 Attachment
      hi,




      I have a SOAP-client that looks like this :




      #!/usr/bin/perl -w


      use SOAP::Lite +trace => [qw(method trace fault)];




      sub SOAP::Transport::HTTP::Client::get_basic_credentials {


      return 'myid' => 'youdwannaknowdontyou?';


      }




      my $id = "SOMEID";




      my $soapresult = SOAP::Lite


      -> service('WDSL_SERVICE_LOCATOR')


      -> getCustomerID($id);




      if ($soapresult->fault)


      {


      print "\n\n\n\n\n\n\n";


      print "FAULT!!!!!!!";


      } else


      {


      blah


      }




      However, in returning, the SOAP-server sends a response that is
      indicating an error :




      <?xml version="1.0" encoding="UTF-8"?>


      <e:Envelope xmlns:e="http://schemas.xmlsoap.org/soap/envelope/">


      <e:Body>


      <f0:Fault xmlns:f0="http://schemas.xmlsoap.org/soap/envelope/">


      <faultcode>f0:Client.InvalidParameter</faultcode>


      <faultstring>No session found for id=MYID</faultstring>


      <detail>


      <ns0:errorDetail xmlns:ns0="SOMEWSDL">


      <errorCode>InvalidParameter</errorCode>


      <errorMessage>No session found for id=MYID</errorMessage>


      </ns0:errorDetail>


      </detail>


      </f0:Fault>


      </e:Body>


      </e:Envelope>




      It seems to me that this should be coded in the $s
      oapresult-structure,
      but Perl keeps on bugging that it "Can't call method "fault" on an
      undefined value at scriptfile.pl line 22.". So, the result is undef!
      The server is responding with a 500 Internal Server Error (as it
      should, according to the specification).




      Any clues here ?
    • Rushikesh Joshi
      Hi, I have faced same problem that you having. And this group helps me lot. Try out below code to work throo. some code..... my $soapresult = SOAP::Lite -
      Message 2 of 2 , Aug 22, 2004
      • 0 Attachment

        Hi,
         
        I have faced same problem that you having. And this group helps me lot.
        Try out below code to work throo.
         
        some code.....
         
        my $soapresult = SOAP::Lite
                        -> service('WDSL_SERVICE_LOCATOR')
                        -> getCustomerID($id);

        my $som = $soapresult->call();
        if ($som->fault) {
            # it failed
            print $som->faultdetail;
            print $som->faultcode;
            print $som->faultstring;
        } else {
            # it worked
            print $som->$result; #This will print result
        }
         
        SOM's other access methods are ....
         
          print "\n","Fault Details:\n",$som->faultdetail,"\n";
          print "\n","Fault Code:\n",$som->faultcode,"\n";
          print "\n","Fault String:\n",$som->faultstring,"\n";
          print "\n","Fault faultactor:\n",$som->faultactor,"\n";
          print "\n","Fault Body:\n",$som->body,"\n"; #Dumper($som->body) 
          print "\n","Fault header:\n",$som->header,"\n"; #Dumper($som->body)
          print "\n","Fault headers:\n",$som->headers,"\n"; #Dumper($som->body)
          print "\n","Fault envelope:\n",$som->envelope,"\n"; #Dumper($som->body)
          body and envelop are returning HASH so u need do Data Dumper view it. 
          use Data::Dumper; to initialize Dumper Class 
         Regards,
         Rushikesh.
         Helps to others, see others will help you.

        doevincent <doevincent@...> wrote:

        hi,
        I have a SOAP-client that looks like this :

        #!/usr/bin/perl -w
        use SOAP::Lite +trace => [qw(method trace fault)];
        sub SOAP::Transport::HTTP::Client::get_basic_credentials {
           return 'myid' => 'youdwannaknowdontyou?';
        }

        my $id = "SOMEID";

        my $soapresult = SOAP::Lite
                        -> service('WDSL_SERVICE_LOCATOR')
                        -> getCustomerID($id);

        if ($soapresult->fault)
        {
                print "\n\n\n\n\n\n\n";
                print "FAULT!!!!!!!";
        } else
        {
        blah
        }

        However, in returning, the SOAP-server sends a response that is
        indicating an error :

        ................................

         


        Do you Yahoo!?
        New and Improved Yahoo! Mail - Send 10MB messages!

      Your message has been successfully submitted and would be delivered to recipients shortly.