Question

I am using SOAPFaultException to customize my response whenever I need to raise an exception. But in case of exceptions like NullPointerException, full stacktrace of my code gets sent to client. I was wondering is there a way in jax-ws to customize all non-SOAPFaultException? So instead of showing full stacktrace, I'll say something like "Internal Server Exception"?

Thanks!

Was it helpful?

Solution

You can disable the inclusion of the stack trace in the SOAP fault message by setting the com.sun.xml.ws.fault.SOAPFaultBuilder.disableCaptureStackTrace Java startup property to false.

Source: http://docs.oracle.com/middleware/1212/wls/WSGET/jax-ws-soapfaults.htm#BABGDDEA

The chapter Using Unmodeled Faults in the same document has some explanation and a reference to SOAP Message Handlers. This would allow you to tweak processing of unmodeled faults i.e. RuntimeExceptions.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top