You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Jim Talbut <jt...@spudsoft.co.uk> on 2009/09/21 19:03:16 UTC

Capture RESPONSE_CODE and PROTOCOL_HEADERS on outbound message

Hi,

How can I capture (to log to a database) the RESPONSE_CODE and 
PROTOCOL_HEADERS of a response message?
I'm working with a modified version of the LoggingOutInterceptor, which 
captures the body but not the headers.


Also, how can I get a correlation ID to tie together a message on the 
inbound and outbound interceptors?
I was hoping the message.getId() would provide something, but it doesn't 
seem to (even if I set it in the inbound interceptor).

Thanks

Jim

Re: Capture RESPONSE_CODE and PROTOCOL_HEADERS on outbound message

Posted by Daniel Kulp <dk...@apache.org>.
On Tue September 22 2009 2:20:53 pm Jim Talbut wrote:
> Jim Talbut wrote:
> > How can I capture (to log to a database) the RESPONSE_CODE and
> > PROTOCOL_HEADERS of a response message?
> > I'm working with a modified version of the LoggingOutInterceptor,
> > which captures the body but not the headers.
> 
> Are these values only available at certain phases of the outbound
> processing?

Probably.   It may not set a fault code until it knows it's a fault, etc...

> Is there a list of what is available when somewhere?

I generally just look at the source:

http://svn.apache.org/repos/asf/cxf/trunk/rt/core/src/main/java/org/apache/cxf/phase/PhaseManagerImpl.java

 
> > Also, how can I get a correlation ID to tie together a message on the
> > inbound and outbound interceptors?
> > I was hoping the message.getId() would provide something, but it
> > doesn't seem to (even if I set it in the inbound interceptor).

In general, you can call message.getExchange() which contains the exchange.   
It holds onto the in and out message so they are already correlated.     
message.getExchange().getInMessage() probably is what you want.

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Re: Capture RESPONSE_CODE and PROTOCOL_HEADERS on outbound message

Posted by Jim Talbut <jt...@spudsoft.co.uk>.
Jim Talbut wrote:
> How can I capture (to log to a database) the RESPONSE_CODE and 
> PROTOCOL_HEADERS of a response message?
> I'm working with a modified version of the LoggingOutInterceptor, 
> which captures the body but not the headers.
Are these values only available at certain phases of the outbound 
processing?
Is there a list of what is available when somewhere?
> Also, how can I get a correlation ID to tie together a message on the 
> inbound and outbound interceptors?
> I was hoping the message.getId() would provide something, but it 
> doesn't seem to (even if I set it in the inbound interceptor).
I've been playing with this further, trying to use message.get( 
message.INVOCATION_CONTEXT ), but this is always null on the outbound 
interceptor.
I thought that was possibly because I needed the inbound message, but I 
can't find any way to access that.

Any ideas?

Thanks.

Jim