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

Re: [soaplite] die, but without SOAP::Fault

Expand Messages
  • MikeG
    Try this: eval { #do stuff that might die ... } if ($exception = $@) { # use $exception to formulate your $response return $response; } Hope this helps Mike
    Message 1 of 3 , Sep 30, 2005
    • 0 Attachment
      Try this:

      eval {
      #do stuff that might die
      ...
      }
      if ($exception = $@) {
      # use $exception to formulate your $response
      return $response;
      }

      Hope this helps
      Mike

      teden wrote:

      >Folks,
      >
      >I have a SOAP::Lite web service which needs to compose its response
      >based on a schema definition. The problem is, I routinely trap
      >significant error conditions and report them back to the caller
      >through the use of
      >
      > die SOAP::Fault
      > ->faultcode("blah")
      > ->faultstring("blah")
      > ->faultdetail("blah");
      >
      >which works great but does not fit into the response model. I tried
      >"die SOAP::Data->cccccccc" but it doesn't work (as if it should
      >have)...
      >
      >As such, I need to be able to
      >
      > 1. Detect an error condition and trap it
      > 2. Immediately stop the current execution path
      > 3. Build my response based on the schema definition
      > 4. Return the response
      >
      >I currently do items 1, 3 and 4. The problem is number 2. How do I get
      >Perl to stop the current execution path and go to where I want it to?
      >The evil 'goto' will not suffice and another method call only adds an
      >element to the call stack. This has to be a Perl 101 question, but I
      >can't seem to solve it. Any help out there?
      >
      >Any help is most appreciated,
      >
      >Thom Eden
      >
      >
      >
      >
      >
      >
      >Yahoo! Groups Links
      >
      >
      >
      >
      >
      >
      >
      >
      >
    • Thomas Eden
      Thanks, I tried this but it still ends up returning control to the program... I did a bit more research and came across Error.pm on CPAN. It provides a
      Message 2 of 3 , Sep 30, 2005
      • 0 Attachment
        Thanks, I tried this but it still ends up returning control to the
        program...

        I did a bit more research and came across Error.pm on CPAN. It provides a
        java-like Exception handling paradigm whereby a thrown exception will fall
        back through the call tree until it is caught. So, when I detect an error
        condition, I throw an exception and catch it in the top-most level of the
        call tree. Problem solved!

        -----Original Message-----
        From: soaplite@yahoogroups.com [mailto:soaplite@yahoogroups.com] On Behalf
        Of MikeG
        Sent: Friday, September 30, 2005 04:11
        Cc: soaplite@yahoogroups.com
        Subject: Re: [soaplite] die, but without SOAP::Fault

        Try this:

        eval {
        #do stuff that might die
        ...
        }
        if ($exception = $@) {
        # use $exception to formulate your $response
        return $response;
        }

        Hope this helps
        Mike

        teden wrote:

        >Folks,
        >
        >I have a SOAP::Lite web service which needs to compose its response
        >based on a schema definition. The problem is, I routinely trap
        >significant error conditions and report them back to the caller through
        >the use of
        >
        > die SOAP::Fault
        > ->faultcode("blah")
        > ->faultstring("blah")
        > ->faultdetail("blah");
        >
        >which works great but does not fit into the response model. I tried
        >"die SOAP::Data->cccccccc" but it doesn't work (as if it should
        >have)...
        >
        >As such, I need to be able to
        >
        > 1. Detect an error condition and trap it 2. Immediately stop the
        > current execution path 3. Build my response based on the schema
        > definition 4. Return the response
        >
        >I currently do items 1, 3 and 4. The problem is number 2. How do I get
        >Perl to stop the current execution path and go to where I want it to?
        >The evil 'goto' will not suffice and another method call only adds an
        >element to the call stack. This has to be a Perl 101 question, but I
        >can't seem to solve it. Any help out there?
        >
        >Any help is most appreciated,
        >
        >Thom Eden
        >
        >
        >
        >
        >
        >
        >Yahoo! Groups Links
        >
        >
        >
        >
        >
        >
        >
        >
        >



        ------------------------ Yahoo! Groups Sponsor --------------------~--> Fair
        play? Video games influencing politics. Click and talk back!
        http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/W6uqlB/TM
        --------------------------------------------------------------------~->


        Yahoo! Groups Links
      Your message has been successfully submitted and would be delivered to recipients shortly.