On Wed March 25 2009 2:28:32 pm [email protected] wrote:
> Has anyone integrated CXF and JAMon (http://jamonapi.sourceforge.net/)
> successfully? I would like to track web service hits using JAMon but I
> don't know where to *centralize* the code. We are converting an existing
> XML over HTTP app to SOAP using CXF. In the current app we have a central
> point of control in our Servlet ( every call goes through this servlet ) so
> we trap it there and log the hit in JAMon. We know which request handlers
> are hit and how long it takes to respond. With SOAP and CXF the stack
> (CXFServlet) is the central point of control and I don't know where to trap
> the calls and the duration. I am pretty sure it will be in an *interceptor*
> but which one?

The BEST option is to look at the ResponseTime interceptors and stuff that we 
already have in the cxf-rt-management module.   They currently feed out 
through JMX, but you could probably extend it out to feed to JAMon.   Either 
that or just take the interceptors and modify the code as needed.


> When I dump the inbound SOAP message I see the <Action> element in the log.
> But when I try get at this <Action> element programmatically I only get "".

What you did would get the SOAPAction HTTP header, not the ws-addressing 
header.   The easiest would be AFTER the ws-addressing interceptors run, do:

AddressingProperties inProps = (AddressingProperties)message
                
.getContextualProperty(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND);
and grab the action from there. 

Alternatively:

soapMessage.getHeaders() returns a List<Header> which is the headers in the 
SOAP message.   You can iterate over that to find the header you need.

Dan


>
> <Action
> xmlns="http://www.w3.org/2005/08/addressing";>http://server.cxf.asi.cox.com/
>CustomerService/getCustomers</Action>
>
> Any thought are greatly appreciated.
>
> What I did:
>
> I created a "StatisticsInterceptor" that extends SoapActionInInterceptor
> In the handleMessage(SoapMessage message) method I tried to get a the
> SOAP_ACTION and I get and empty string including the quotes.
>
> StatisticsInterceptor:75 - SOAP_ACTION [""]
>
>
>          Map<String, List<String>> headers =
>             CastUtils.cast(
>                ( Map ) message.get( Message.PROTOCOL_HEADERS ) );
>
>          List<String> sa =
>              headers.get(SoapBindingConstants.SOAP_ACTION);
>
>          for ( String s : sa )
>          {
>              logger.debug("SOAP_ACTION [" + s + "]");
>          }
>
>
>
> Jeffrey M. Constantin | Cox Communications Inc.
> Data Product Services (DPS) | Architecture & Systems Integration (ASI)
> Desk: 404-269-3111 | Mobile: 678.643.6528

-- 
Daniel Kulp
[email protected]
http://www.dankulp.com/blog

Reply via email to