OK I found a workaround that works but it's very obscure:
@Override
public void handleFault(SoapMessage message) {
...
Marshaller marshaller =
JAXBContext.newInstance(MessageHeader.class).createMarshaller();
SOAPMessage soap = message.getContent(SOAPMessage.class);
soap.getSOAPHeader().removeContents();
marshaller.marshal(msgHeader, soap.getSOAPHeader());
HttpServletResponse response = (HttpServletResponse)
message.get(AbstractHTTPDestination.HTTP_RESPONSE);
message.setContent(OutputStream.class, response.getOutputStream());
Exception e = message.getContent(Exception.class);
soap.getSOAPBody().removeContents();
marshaller.marshal(OneAXmlUtil.buildErrorList(msgHeader, e),
soap.getSOAPBody());
soap.writeTo(response.getOutputStream());
response.getOutputStream().close();
Is there any "nice" way to do this?
Cheers,
Przemyslaw
--
View this message in context:
http://cxf.547215.n5.nabble.com/Custom-fault-response-JAX-WS-tp5737771p5737775.html
Sent from the cxf-dev mailing list archive at Nabble.com.