You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by purnacha <pu...@gmail.com> on 2012/10/01 12:17:49 UTC

XML prolog in soap fault

Hi,
Is there a way to add an XML prolog to a soap fault. i wrote a
Faultoutinterceptor and tried adding the xml prolog. I see that the
interceptor is called , changed the encoding but due to some reason XML
prolog is not added the soap fault.My doubt is whether StaxOutInterceptor is
used to generate the SOAP fault or something else. If it is something else ,
is there a way to add a XML prolog?

 Any help would be greatly appreciated.

Please find my interceptor code below:

/import org.apache.cxf.interceptor.Fault;
import org.apache.cxf.interceptor.FaultOutInterceptor;
import org.apache.cxf.interceptor.StaxOutInterceptor;
import org.apache.cxf.message.Message;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class CustomFaultOutInterceptor extends FaultOutInterceptor {
	
	private final Logger logger = LoggerFactory.getLogger(getClass());
	
	public CustomFaultOutInterceptor () {
		addBefore(StaxOutInterceptor.class.getName());
	}
	
	@Override
	public void handleMessage(Message message) throws Fault {
		logger.debug("Adding XML Prolog to response"+message);
		message.put(Message.ENCODING, "UTF-8"); 
        message.put(StaxOutInterceptor.FORCE_START_DOCUMENT, Boolean.TRUE);   
       
		
	}

}/

Thanks
-Purna



--
View this message in context: http://cxf.547215.n5.nabble.com/XML-prolog-in-soap-fault-tp5715175.html
Sent from the cxf-issues mailing list archive at Nabble.com.