cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Jeffrey.Constan...@cox.com>
Subject RE: CXF and JAMON integration?
Date Mon, 30 Mar 2009 16:08:20 GMT
FYI:



Found the solution: Spring has a JamonPerformanceMonitorInteceptor you can easily wire into
your web services beans as follows.

This is an Aspect Oriented Programming (AOP) solution that works great. For every method call
in my bean we get stats like hits, execution time, min and max time, and etc.



This is a very good use of AOP and an easy implementation. Thanks Spring!!!


      <!-- BEANS -->
      <bean id="serviceBean" class="com.ws.CustomerServiceImpl" />



      <!-- wire the Advice -->

      <bean id="jamonInterceptor"

            class="org.springframework.aop.interceptor.JamonPerformanceMonitorInteceptor">

      </bean>



      <!-- wire the PointCut -->

      <bean id="jamonPointcut"

            class="org.springframework.aop.support.RegexpMethodPointcutAdvisor">

            <property name="advice">

                  <ref local="jamonInterceptor" />

            </property>

            <property name="patterns">

                  <list>

                        <value>.*</value>

                  </list>

            </property>

      </bean>



   <!-- wire the Bean and the PointCut together -->

      <bean id="jamonProxyCreator"

            class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">

            <property name="beanNames">

                  <value>serviceBean</value>

            </property>

            <property name="interceptorNames">

                  <list>

                        <value>jamonPointcut</value>

                  </list>

            </property>

   </bean>



-----Original Message-----
From: Jeffrey.Constantin@cox.com [mailto:Jeffrey.Constantin@cox.com]
Sent: Wednesday, March 25, 2009 2:29 PM
To: users@cxf.apache.org
Subject: CXF and JAMON integration?



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?



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 "".



<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









Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message