cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marckropholler <>
Subject fixed
Date Tue, 27 Mar 2012 10:01:23 GMT
Dear all,

Found the following two or three solutions:

1. instantiate custom JAXB/CXF classes that parse the object to xml. The
only thing is that you have to wrap the object in a class containing
@XmlRootElement, which ends up in the exception, but since the classes write
to a org.w3c.dom.Element it (looks like) you can get its child element and
use that. Sample code (without removing root element from xml):

public void handleFault(Message message) {
        Fault fault = (Fault) message.getContent(Exception.class);
	binding = new
org.apache.cxf.jaxb.JAXBDataBinding(FoutberichtTypeHolder.class); writer = new;
	writer.write(new FoutberichtTypeHolder(foutberichtType), null,

2. Hacky: create a document from an xml file and use that:

public void handleFault(Message message) {
        Fault fault = (Fault) message.getContent(Exception.class);
	InputStream inputStream = new
	Document document = DOMUtils.createDocumentBuilder().parse(inputStream);
	Node node = XPathAPI.selectSingleNode(document, xpath);

3. Don't know if this one works, but it may: create a Fault object as you
want by specifying it in the wsdl, and setting
it using message.setContent(Exception.class, fault).

Best wishes

View this message in context:
Sent from the cxf-user mailing list archive at

View raw message