I am using following piece of code to set the response.

ByteArrayInputStream stream = new ByteArrayInputStream(
                                                        responseXML);
StreamSource source = new StreamSource(stream);
SOAPMessage soapMessage = MessageFactory.newInstance().createMessage();
soapMessage.getSOAPPart().setContent(source);
soapMessage.saveChanges();

Message responseMsg = new MessageImpl();
responseMsg.setExchange(message.getExchange());
responseMsg = ep.getBinding()
                .createMessage(responseMsg);
message.getExchange().setOutMessage(responseMsg);
responseMsg.setContent(SOAPMessage.class, soapMessage);
responseMsg.setContent(InputStream.class, stream);

// responseMsg.setContent(InputStream.class, stream);
InterceptorChain chain = OutgoingChainInterceptor
                .getOutInterceptorChain(message.getExchange());
responseMsg.setInterceptorChain(chain);

chain.doInterceptStartingAfter(responseMsg,SoapPreProtocolOutInterceptor.class.getName());

But in the response I am getting empty envelope with nothing in body. Can
some one point out what is wrong.


-- 
View this message in context: 
http://cxf.547215.n5.nabble.com/Sending-custom-response-from-Interceptor-tp3368193p3368338.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to