I'm not really seeing a way to do it without writing an interceptor. CXF,
generally, tries to discard things that aren't needed anymore whenever it can.
In this case, by the time the exception is thrown, the SOAPMessage has been
discarded.
Using an interceptor, you could save the SOAPMessage and then retrieve it
later view the dispatch.getResponseContext(). It would really be something
like:
SOAPMessage m = msg.getContent(SOAPMessage.class);
msg.put("my.soap.message", m);
That should stick it in the response context.
Dan
On Thu November 26 2009 5:02:39 am Lukasz Lichota wrote:
> Hi,
>
> I'm using Dispatch and I'd like to return soap message (as e.g. Source) no
> matter if there was an exception or normal response, is there a way to tell
> Dispatch not to throw SOAPFaultException?
> If not, what's the easiest way to transform it to the whole-message Source?
> I can do something like this:
> catch(SOAPFaultException e)
> {
> SOAPFault fault = e.getFault();
> Source response = new DOMSource(fault);
> }
> but then response contains only soap:fault without body and envelope. How
> to easily construct the whole envelope? Do I need to manually create XML
> for soap elements is maybe there's any utility to do this?
>
--
Daniel Kulp
[email protected]
http://www.dankulp.com/blog