0 Replies Latest reply on May 31, 2007 8:17 AM by Frederic Burlet

    JAXWS: handlers and exceptions

    Frederic Burlet Newbie


      I don't understand everything in the exception handling in JAXWS.
      I written a small webservice; the code is here under:

      package com.kiala.handler.test.webservice;
      import javax.ejb.Stateless;
      import javax.jws.HandlerChain;
      import javax.jws.WebService;
      import javax.jws.soap.SOAPBinding;
      import com.kiala.handler.test.exception.UserException;
      @HandlerChain(file = "handler-chain.xml")
      @SOAPBinding(style = SOAPBinding.Style.RPC, use = SOAPBinding.Use.LITERAL)
      public class ExceptionService {
       public String throwException(String s) throws UserException {
       if ("Hello".equals(s)) {
       return "World!";
       } else {
       throw new UserException(s);

      UserException is a custom exception extending java.lang.Exception.

      My question is: is UserException obliged to extend java.lang.RuntimeException in ordre to trigger the execution of the handlers's handleFault(MessageContext msgContext) method ? If I don't extend RuntimeException, the handleFault(MessageContext msgContext) is not executed... Note that the generated response is the same if I extend RuntimeException or not: the reason of my question. The specification and the doc is not clear (at least for me) about that.

      I'm using jboss 4.2.0.GA and jbossws 1.2.1.GA with jdk 1.5.

      Thanks for you help,