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

Catching a 500 Error client side?

Expand Messages
  • Adhamh Findlay
    Hello, I ve got a simple soap client that looks like this: #!/usr/bin/perl use SOAP::Lite; my $soap = SOAP::Lite- service( http:/some.server.com:4221 );
    Message 1 of 4 , Jul 3, 2003
    • 0 Attachment
      Hello,

      I've got a simple soap client that looks like this:

      #!/usr/bin/perl
      use SOAP::Lite;
      my $soap = SOAP::Lite->service("http:/some.server.com:4221");
      $soap->setPersonStatus(30, 1000039);

      Right now, if the server is down or otherwise times out I get this error:

      Service description 'http:/some.server.com' can't be loaded: 500 Can't
      connect
      to some.server.com:4221 (Timeout)


      At this point, my client dies. This client actually needs to keep running
      in
      the background...

      Is there a way to catch this 500 error on the client side, report the error,
      and keep running? I found information in the docs about server side
      faulting
      and errors, but nothing about the client side.


      Thanks!

      Adhamh Findlay
    • Byrne Reese
      You should be able to wrap the call in an eval block and effectively catch the error: use SOAP::Lite; my $soap =
      Message 2 of 4 , Jul 3, 2003
      • 0 Attachment
        You should be able to wrap the call in an eval block and effectively
        catch the error:

        use SOAP::Lite;
        my $soap = SOAP::Lite->service("http:/some.server.com:4221");
        eval {
        $soap->setPersonStatus(30, 1000039);
        }
        # An error will be stored in $! if one occurs.

        On Thu, 2003-07-03 at 12:09, Adhamh Findlay wrote:
        > Hello,
        >
        > I've got a simple soap client that looks like this:
        >
        > #!/usr/bin/perl
        > use SOAP::Lite;
        > my $soap = SOAP::Lite->service("http:/some.server.com:4221");
        > $soap->setPersonStatus(30, 1000039);
        >
        > Right now, if the server is down or otherwise times out I get this
        > error:
        >
        > Service description 'http:/some.server.com' can't be loaded: 500 Can't
        > connect
        > to some.server.com:4221 (Timeout)
        >
        >
        > At this point, my client dies. This client actually needs to keep
        > running
        > in
        > the background...
        >
        > Is there a way to catch this 500 error on the client side, report the
        > error,
        > and keep running? I found information in the docs about server side
        > faulting
        > and errors, but nothing about the client side.
        >
        >
        > Thanks!
        >
        > Adhamh Findlay
        >
        >
        > Yahoo! Groups Sponsor
        > ADVERTISEMENT
        > click here
        >
        > To unsubscribe from this group, send an email to:
        > soaplite-unsubscribe@yahoogroups.com
        >
        >
        >
        > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
        --
        Byrne Reese
        Developer Program Manager
        Grand Central Communications
      • Igor Korolev
        First of all, an error will be in $@ (not $!). You also forgot semicolon after closing eval bracket. Most important -- Soap::Lite does NOT die in case of 500
        Message 3 of 4 , Jul 7, 2003
        • 0 Attachment
          First of all, an error will be in $@ (not $!). You also forgot
          semicolon after closing eval bracket.

          Most important -- Soap::Lite does NOT die in case of 500 fault,
          so eval will NOT catch any error.

          -----Original Message-----
          From: Byrne Reese [mailto:breese@...]
          Sent: Thursday, July 03, 2003 3:55 PM
          To: Adhamh Findlay
          Cc: SOAP Lite Mailing List
          Subject: Re: [soaplite] Catching a 500 Error client side?


          You should be able to wrap the call in an eval block and effectively
          catch the error:

          use SOAP::Lite;
          my $soap = SOAP::Lite->service("http:/some.server.com:4221");
          eval {
          $soap->setPersonStatus(30, 1000039);
          }
          # An error will be stored in $! if one occurs.

          On Thu, 2003-07-03 at 12:09, Adhamh Findlay wrote:
          > Hello,
          >
          > I've got a simple soap client that looks like this:
          >
          > #!/usr/bin/perl
          > use SOAP::Lite;
          > my $soap = SOAP::Lite->service("http:/some.server.com:4221");
          > $soap->setPersonStatus(30, 1000039);
          >
          > Right now, if the server is down or otherwise times out I get this
          > error:
          >
          > Service description 'http:/some.server.com' can't be loaded: 500 Can't
          > connect
          > to some.server.com:4221 (Timeout)
          >
          >
          > At this point, my client dies. This client actually needs to keep
          > running
          > in
          > the background...
          >
          > Is there a way to catch this 500 error on the client side, report the
          > error,
          > and keep running? I found information in the docs about server side
          > faulting
          > and errors, but nothing about the client side.
          >
          >
          > Thanks!
          >
          > Adhamh Findlay
          >
          >
          > Yahoo! Groups Sponsor
          > ADVERTISEMENT
          > click here
          >
          > To unsubscribe from this group, send an email to:
          > soaplite-unsubscribe@yahoogroups.com
          >
          >
          >
          > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
          --
          Byrne Reese
          Developer Program Manager
          Grand Central Communications



          To unsubscribe from this group, send an email to:
          soaplite-unsubscribe@yahoogroups.com



          Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
        • Byrne Reese
          Doh - typed too fast. I stand corrected. Although I like $! as an error related variable better. :-/ Perhaps SOAP::SOM could have a new subroutine is_error()
          Message 4 of 4 , Jul 7, 2003
          • 0 Attachment
            Doh - typed too fast. I stand corrected. Although I like '$!' as an
            error related variable better. :-/

            Perhaps SOAP::SOM could have a new subroutine is_error() that could map
            to the transport layer in someway to see if an error occured during
            transport - this might provide a more elegant way to capture these types
            of errors.

            But SOAP::Lite does die for transport errors... well LWP does anyways.
            Check out the behavior of these two script fragments.

            my $som;
            eval {
            $som = $soap->someMethod("foo");
            };
            if ($@) {
            print "An error occured during transport: $@\n";
            } else {
            print "The response from the server was:\n".$som->result;
            }

            and...

            my $som = $soap->someMethod("foo");
            print "The response from the server was:\n".$som->result;

            You will notice that in the second one, the print statement is never
            executed because LWP dies with the HTTP status code and string as error
            text.

            On Mon, 2003-07-07 at 07:42, Igor Korolev wrote:
            > First of all, an error will be in $@ (not $!). You also forgot
            > semicolon after closing eval bracket.
            >
            > Most important -- Soap::Lite does NOT die in case of 500 fault,
            > so eval will NOT catch any error.
            >
            > -----Original Message-----
            > From: Byrne Reese [mailto:breese@...]
            > Sent: Thursday, July 03, 2003 3:55 PM
            > To: Adhamh Findlay
            > Cc: SOAP Lite Mailing List
            > Subject: Re: [soaplite] Catching a 500 Error client side?
            >
            >
            > You should be able to wrap the call in an eval block and effectively
            > catch the error:
            >
            > use SOAP::Lite;
            > my $soap = SOAP::Lite->service("http:/some.server.com:4221");
            > eval {
            > $soap->setPersonStatus(30, 1000039);
            > }
            > # An error will be stored in $! if one occurs.
            >
            > On Thu, 2003-07-03 at 12:09, Adhamh Findlay wrote:
            > > Hello,
            > >
            > > I've got a simple soap client that looks like this:
            > >
            > > #!/usr/bin/perl
            > > use SOAP::Lite;
            > > my $soap = SOAP::Lite->service("http:/some.server.com:4221");
            > > $soap->setPersonStatus(30, 1000039);
            > >
            > > Right now, if the server is down or otherwise times out I get this
            > > error:
            > >
            > > Service description 'http:/some.server.com' can't be loaded: 500 Can't
            > > connect
            > > to some.server.com:4221 (Timeout)
            > >
            > >
            > > At this point, my client dies. This client actually needs to keep
            > > running
            > > in
            > > the background...
            > >
            > > Is there a way to catch this 500 error on the client side, report the
            > > error,
            > > and keep running? I found information in the docs about server side
            > > faulting
            > > and errors, but nothing about the client side.
            > >
            > >
            > > Thanks!
            > >
            > > Adhamh Findlay
            > >
            > >
            > > Yahoo! Groups Sponsor
            > > ADVERTISEMENT
            > > click here
            > >
            > > To unsubscribe from this group, send an email to:
            > > soaplite-unsubscribe@yahoogroups.com
            > >
            > >
            > >
            > > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
            --
            Byrne Reese
            Developer Program Manager
            Grand Central Communications
          Your message has been successfully submitted and would be delivered to recipients shortly.