0 Replies Latest reply on Apr 16, 2009 9:15 AM by Kamil Demecki

    WebFault and Declared RuntimeException is wrapped by SOAPFau

    Kamil Demecki Novice

      Hi All !

      I'm writing webservice with JBoss 4.2.3 and jbossws-native-3.0.3.GA. When I declare checked exception, client can catch right unbinded exception.

      @WebMethod
       public String testWyjatek003(@WebParam(name = "paramString") String paramString) throws WyjatekTestowy,
       WyjatekTestowyDziedziczacy;


      When I declare runtime exception, exception is right unmarshalled as cause of SOAPFaultException but is not unwrapped.
       @WebMethod
       public String testWyjatekRuntime005(@WebParam(name = "paramString") String paramString)
       throws WyjatekTestowyRuntime02;
      
       @WebFault
       @ApplicationException(rollback = true)
       public class WyjatekTestowyRuntime02 extends RuntimeException {
       [...]
       }
      


      I was investigating this case and I found ClientProxy.handleException(Exception ex)

      private void handleException(Exception ex) throws Throwable
       {
       if (ex instanceof SOAPFaultException)
       {
       // Unwrap the cause if it is an Application Exception, otherwise use a protocol exception
       Throwable cause = ex.getCause();
       if (cause instanceof Exception)
       {
       // Throw unwrapped WebServiceException
       if (cause instanceof WebServiceException)
       throw (WebServiceException)cause;
      
       // Throw wrapped SOAPException
       if (cause instanceof SOAPException)
       throw (SOAPFaultException)ex;
      
       // Throw wrapped RuntimeException
       if (cause instanceof RuntimeException)
       throw (SOAPFaultException)ex;
      
       // Throw all other causes
       throw (Exception)cause;
       }
       }
       throw ex;
       }


      So RuntimeException is wrapped with SOAPFaultException.

      Is there way to write transparent code with declaring RuntimException and services with JBossWS ?