java - How to send custom response message instead of Fault message in case of an exception with JAXWS? -
in jaxws web service need send specific message client when exception occurs, not standard fault message description of exception.
how can done?
i using jaxws-rt version 2.1.3
i have tried use exception mappers without luck (some how not called, caused mistake in 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 use jboss eap 6.4.
edit:
exception mapper approach not suited jaxws web service, because jax-rs (thanks srinivas k). there similar available jaxws?
can try using below?
string errormessage = "this custom error message"; return response.status(e.getresponse().getstatus()).entity(errormessage).build();
Comments
Post a Comment