Problem
By default, JAX-WS builds the following SOAP fault message when an uncaught exception that extends RuntimeException
occurs on my server:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<S:Fault xmlns:ns3="http://www.w3.org/2003/05/soap-envelope">
<faultcode>S:Server</faultcode>
<faultstring>[runtime exception message here]</faultstring>
<detail>
<ns2:exception class="java.lang.RuntimeException" note="To disable this feature, set com.sun.xml.ws.fault.SOAPFaultBuilder.disableCaptureStackTrace system property to false" xmlns:ns2="http://jax-ws.dev.java.net/">
<message>[runtime exception message here too]</message>
<ns2:stackTrace>
[stack trace details]
</ns2:stackTrace>
</ns2:exception>
</detail>
</S:Fault>
</S:Body>
</S:Envelope>
Which kind of make sense, except that I'd like to change that behavior in order to send that instead:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<S:Fault xmlns:ns3="http://www.w3.org/2003/05/soap-envelope">
<faultcode>S:Server</faultcode>
<faultstring>Something wrong happened and it's totally our fault</faultstring>
</S:Fault>
</S:Body>
</S:Envelope>
Note that the message should NOT be the RuntimeException's message content, but a custom static message for any exception that extends RuntimeException
that may occur server-side.
I can't change the WSDL and I don't want to set a custom exception.
I'm using the spring plugin: com.sun.xml.ws.transport.http.servlet.WSSpringServlet
How can I do that?
exception
tag there is an attributenote
that says 'To disable this feature, set com.sun.xml.ws.fault.SOAPFaultBuilder.disableCaptureStackTrace system property to false'. Did you try that? Did you try to find out whether there is a property to disable entire details? – Vestry