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;
@WebMethod
public String testWyjatekRuntime005(@WebParam(name = "paramString") String paramString)
throws WyjatekTestowyRuntime02;
@WebFault
@ApplicationException(rollback = true)
public class WyjatekTestowyRuntime02 extends RuntimeException {
[...]
}
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;
}