In my JAXWS web service I need to send a specific message back to the client when an exception occurs, not the standard Fault message with the description of the exception.
How can this be done?
I am using jaxws-rt version 2.1.3
I have already tried to use exception mappers like this but without luck (some how they are not called, this could also be caused by a mistake in the configuration):
@Provider
public class ThrowableExceptionMapper implements ExceptionMapper<Throwable> {
public ThrowableExceptionMapper() {
// TODO Auto-generated constructor stub
}
@Override
public Response toResponse(Throwable throwable) {
if (throwable instanceof WebApplicationException) {
return ((WebApplicationException) throwable).getResponse();
} else {
return Response.serverError().entity("").build();
}
}
}
The server we use is JBoss EAP 6.4.
Edit:
The exception mapper approach is not suited for my JAXWS web service, because this is for JAX-RS (thanks SRINIVAS K).
Is there something similar available for JAXWS?