Gert
Gert

Reputation: 230

How to propagate CXF exceptions from server to client

I have a WSDL First Apache CXF web service that works as expected, except that the exceptions that I throw on the server side are not received as such on the client. Instead on the client side I get an exception of type SOAPFaultException in which only the detailMessage contains the message from the original server side Exception, but I'd like to receive the exact exception type I threw on the server side, including the cause chain.

I expected this to work like this by default, but it certainly doesn't in my system. I have been checking the CXF documentation to find hints about how to achieve this, but so far I haven't found anything useful.

Upvotes: 1

Views: 742

Answers (1)

DiogoSantana
DiogoSantana

Reputation: 2434

The SOAP reference does not support stacktrace. If you want that you will need to copy the stacktrace as the message returned by the SoapFault.

With CXF you can do it by add a Interceptor on the income interceptor chain. Please refer to this question to see how to create a interceptor.

You should put it on the POST_INVOKE Phase.

Upvotes: 2

Related Questions