9 Replies Latest reply on Apr 11, 2011 4:42 AM by Giovanni Marigi

    Action OnException problem

    Giovanni Marigi Newbie

      Hi,

      I have an action pipeline where I defined a esb custom action with @OnSuccess and @OnException annotation.

      The action pipeline is composed by only one action, a soap proxy action.

      Everytime I got an exception from the proxy action, the @OnSuccess method is raised, no way to get into a @OnException method.

       

      Any idea?

        • 1. Action OnException problem
          Keith Babo Master

          When you say there's an exception from the proxy action, are you referring to a ActionProcessingException?  And when the exception occurs, your @OnSuccess method is still invoked?

           

          Providing your annotated action class, the jboss-esb.xml, and debug log info just around the SOAP call with exception would all be helpful in providing guidance.

          • 2. Action OnException problem
            Giovanni Marigi Newbie

            Hi Keith,

            No I don't get a ActionProcessingException, I get a generic javax.xml.ws.WebServiceException from my webservice (webservice is implemented through an EJB3).

            Yes the @OnSuccess method is invoked when occurs this kind of exception from the soap proxy.

             

             

            Giovanni

            • 3. Action OnException problem
              Keith Babo Master

              Can you attach your jboss-esb.xml and the annotated action?  Any log information you can provide would also help.

               

              You would not see a WebServiceException being thrown in the action processing pipeline, as this is an exception local to your web service implementation.  This would get returned as a SOAP fault to the SOAP proxy with HTTP 500, in which case I would expect to see information on that in the log.  I can't remember off the top of my head, but I believe that the SOAP fault would be mapped into the response message in the ESB which would explain why you are seeing @OnSuccess getting called.  IOW, the proxying didn't fail in this case, it's just returning the error that it got from the target web service.

               

              ~ keith

              • 4. Re: Action OnException problem
                Giovanni Marigi Newbie

                Hi Keith, attached the files.

                What I don't understand is why the esb is not automatically catching the soap fault generated by the ejb due to an exception (in case you define a @OnException method). I believed that the @OnProcess method should be called before preparing a response message to the client.

                 

                Thanks,

                Giovanni

                • 5. Action OnException problem
                  Giovanni Marigi Newbie

                  sorry I meant the @OnException method

                  • 6. Action OnException problem
                    Keith Babo Master

                    The role of SOAPProxy is to proxy between a web service consumer and provider.  It simply passes through the SOAP traffic and allows you to inject additional logic in the middle.  A SOAP Fault is a valid SOAP message, so SOAPProxy proxies it like any other message.  It's the web service consumer that should view the SOAP fault as an error, not the proxy code in the ESB.

                    • 7. Action OnException problem
                      Giovanni Marigi Newbie

                      Keith thanks for the clear explanation.

                      Do you think a good solution could be to create a post proxy action that catch the SoapFault and throw an ActionProcessingException?

                       

                      Thanks,

                      Giovanni

                      • 8. Action OnException problem
                        Keith Babo Master

                        Sure, you could do that.  You might want to give some thought to what the client of the service (the code invoking SOAPProxy) will get back in that case.  Is there a reason you want the pipeline to fail vs. returning the fault message to the client?  If you would just like to invoke some logic in the pipeline when a fault is returned, you can add an action class that checks for that case and still returns the fault message from it's process method.

                        • 9. Action OnException problem
                          Giovanni Marigi Newbie

                          Exactly I need some custom code on @OnException;

                          thanks a lot Keith