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!

Était-ce utile?

La 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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top