2 Replies Latest reply on Feb 10, 2009 6:50 AM by asoldano

    WeFault and throws declaration

    skajotde

      Hi

      I have that structure

      @WebFault public class BaseAppException {
       ExceptionXBVO getFaultInfo() { ...}
      }
      
      @WebFault public class OtherAppException extends BaseAppException {
       ExceptionXBVO getFaultInfo() { super.getFa...}
      }
      
      public interface IServiceOne {
       @WebMethod public String one(@WebParam("xxx" xxx) throws BaseAppException;
      }
      
      @WebService [...other annotations...] public class SerwiceOne implements IServiceOne {
       @WebMethod public String one(@WebParam("xxx" xxx) throws BaseAppException {
       throw new OtherAppException("info");
       }
      }
      
      


      If web service declare BaseAppException but method throws OtherAppException which inherit on it. Should JBoss WS throw SOAPFaultException or OtherAppException or BaseAppException ?

      I think best solution is to catch OtherAppException by client but in my config is catched SOAPFaultException. When I add OtherAppException to throws declaration then is works as excepted. Does JBoss WS require adding to throws decalarion all possible exception, iheritance doesn't enough ?

        • 1. Re: WeFault and throws declaration
          skajotde

          I see that in 3.0.3.GA Tag in svn there is code

          void org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilder.processWebMethod

          which add fault metadata from declaring exceptions.

           // Add faults
           for (Class<?> exClass : method.getExceptionTypes())
           if (!RemoteException.class.isAssignableFrom(exClass))
           addFault(opMetaData, exClass);


          I'm reading JSR-224 but dont see what spec talk about this situation.


          • 2. Re: WeFault and throws declaration
            asoldano

            That's in JAXWS 2.1 spec, section 3.7. Btw the upcoming 3.1.0 jbossws version will also treat RuntimeException the same way because of the spec conformance requirement.