Hi Daniel

I am trying to send the custom response before invoking the service and
using the sample code which you provided.I have created sample SoapMessage
newMsg which i want to send back to the client.But for some reason i am not
able to see the response going back.Could you please tell me what;s wrong in
the code.

Thanks
Sachin


message.getInterceptorChain().abort();
                
                Endpoint e = message.getExchange().get(Endpoint.class);
                Message responseMsg = new MessageImpl();
                responseMsg.setExchange(message.getExchange());
                responseMsg = e.getBinding().createMessage(responseMsg);
                message.getExchange().setOutMessage(responseMsg);
                //////////////////////
                //Next, create the actual message
                MessageFactory messageFactory =
MessageFactory.newInstance();
                SOAPMessage newMsg = messageFactory.createMessage();
                SOAPPart soapPart =     newMsg.getSOAPPart();
                SOAPEnvelope envelope = soapPart.getEnvelope();
                SOAPBody body =         envelope.getBody();
                //Populate the body
                //Create the main element and namespace
                SOAPElement bodyElement =
                         
body.addChildElement(envelope.createName("getPrice" , 
                                                                       
"ns1", 
                                                 
"urn:xmethods-BNPriceCheck"));
                //Add content
               
bodyElement.addChildElement("isbn").addTextNode("0672324229");                
                newMsg.saveChanges();
                newMsg.writeTo(System.out);                
                
                responseMsg.setContent(SOAPMessage.class, newMsg);              
  
                InterceptorChain chain = OutgoingChainInterceptor
                        .getOutInterceptorChain(responseMsg.getExchange());     
           
                responseMsg.setInterceptorChain(chain);                         
      
                chain.doInterceptStartingAfter(message,
                        SoapPreProtocolOutInterceptor.class.getName());



--
View this message in context: 
http://cxf.547215.n5.nabble.com/Interceptors-sending-a-custom-response-before-invoking-the-service-tp5711790.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to