I think you would just need to move the phase to a later phase.  Likely in the 
Phase.USER_PROTOCOL phase.

Dan


On May 13, 2014, at 12:07 PM, Giriraj Bhojak <girira...@gmail.com> wrote:

> Thank you Daniel and Andrei.
> Here is new interceptor I just wrote for outgoing messages:
> 
> import org.apache.cxf.interceptor.Fault;
> import org.apache.cxf.message.Message;
> import org.apache.cxf.phase.AbstractPhaseInterceptor;
> import org.apache.cxf.phase.Phase;
> import org.w3c.dom.Document;
> 
> public class LoggingOutInterceptor extends
> AbstractPhaseInterceptor<Message>  {
> 
>    public LoggingOutInterceptor() {
>        super(Phase.PRE_PROTOCOL);
>    }
> 
>    public void handleMessage(Message message) throws Fault {
> 
>        Document document = message.getContent(Document.class);
>    }
> 
> }
> 
> The document is null. While debugging I see that the actual object I am
> trying to send is in contents[] array of
> org.apache.cxf.message.MessageImpl.
> But I haven't been able to retrieve it yet. Any idea what I am doing wrong?
> 
> Thanks,
> Giriraj.
> 
> 
> 
> 
> On Tue, May 13, 2014 at 11:00 AM, Daniel Kulp <dk...@apache.org> wrote:
> 
>> 
>> The Logging interceptors run at a byte stream level and only would see the
>> “secured” message.   To log the unsecured message, you would need to write
>> a different interceptor to handle that.  Unfortunately, its also going to
>> be different for CXF 2.7.x and CXF 3.x due to changes in the security
>> handling.
>> 
>> For 2.7.x, you can write an interceptor that would run after the
>> WSS4JInInterceptors that would do a:
>> 
>> message.getContent(Document.class)
>> 
>> and prints the DOM.    For 3.x with the new streaming security
>> interceptors, it would be way more complex.   You’d have to grab the
>> XMLStreamReader from the message, wrapper it with a new stream reader that
>> would then record the read events.   (the wrapped stream reader method
>> would also work for 2.7.x, but like I said, a bit more complex to write)
>> 
>> Dan
>> 
>> 
>> 
>> On May 12, 2014, at 6:05 PM, Giriraj Bhojak <girira...@gmail.com> wrote:
>> 
>>> Hi,
>>> 
>>> I am using cxf (2.7.8 )with wss4j(1.6.13).
>>> For the sake of debugging I need to see the outgoing messages.
>>> I have added cxf:inInterceptors and cxf:outInterceptors in the spring
>>> config.
>>> This helps me see the signed and encrypted message.
>>> Is there a way to see the clear-text version of the message?
>>> I have used JAXB marshaller to print the message but I am trying to avoid
>>> writing any code to see the message.
>>> 
>>> Thanks,
>>> Giriraj.
>> 
>> --
>> Daniel Kulp
>> dk...@apache.org - http://dankulp.com/blog
>> Talend Community Coder - http://coders.talend.com
>> 
>> 

-- 
Daniel Kulp
dk...@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Reply via email to