Hi Guys,
Thanks for the help.  I found a CXF interceptor online based off of the
logging interceptor that gets the message:

    public SoapMessageInterceptor ()
    {
        super(Phase.RECEIVE);
    }

    @Override
    public void handleMessage ( SoapMessage message ) throws Fault
    {
        
        String entireSoapMessage = "";
        
        try
        {
            // now get the request xml
            InputStream is = message.getContent ( InputStream.class );
            CachedOutputStream os = new CachedOutputStream ( );
            IOUtils.copy ( is, os );
            os.flush ( );
            message.setContent (  InputStream.class, os.getInputStream ( )
);
            is.close ( );
            
            entireSoapMessage = IOUtils.toString ( os.getInputStream ( ));

            log.debug ("The request is: " +  entireSoapMessage);
            os.close ( );
        }

        catch ( Exception ex )
        {
            ex.printStackTrace ( );
        }

        message.getExchange().put("entireSoapMessage", entireSoapMessage);

    }


Then in your camel route, you can get that header where we stuffed the
entire soap message as follows:

  Message cxfMessage =
exchange.getIn().getHeader(CxfConstants.CAMEL_CXF_MESSAGE, Message.class);
  String entireSoapMessage = (String)cxfMessage.get("entireSoapMessage");

and then add the interceptor to your CXF bean:

   <cxf:inInterceptors>
        <ref bean="soapMessageInterceptor"/>
   </cxf:inInterceptors>

Thanks,
Yogesh



--
View this message in context: 
http://camel.465427.n5.nabble.com/Getting-entire-Soap-Message-with-header-and-body-in-Payload-mode-tp5753162p5753732.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to