I have a client/server application that communicates via SOAP. The server-side application is a Java EE app that exposes web services using JAX-WS. I have a servlet filter setup to perform certain checks before a service is invoked.
This is all working pretty well, except for exception handling. If I throw an exception from the filter, it gets returned to the client as a generic server exception. I need to find a way to propagate a custom exception containing a specific message, so the client can display the message to the user.
Any insight?
A servlet filter isn't really the right tool if you want to send the exception in a SOAP response and I would consider using a JAX-WS handler for the verification of incoming messages instead (JAX-WS handlers are somehow to JAX-WS services what Filters are to Servlets).
Frmo Working with Headers in JAX-WS SOAPHandlers:
Resources
References
javax.xml.ws.handler.Handler
javax.xml.ws.handler.LogicalHandler
javax.xml.ws.handler.soap.SOAPHandler