[jboss-user] [JBossWS] - JAXWS: handlers and exceptions

fburlet do-not-reply at jboss.com
Thu May 31 08:17:31 EDT 2007


Hi,

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;
  | 
  | @Stateless
  | @WebService
  | @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,

Fred.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4050115#4050115

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4050115



More information about the jboss-user mailing list