1 Reply Latest reply on Aug 12, 2014 2:36 PM by chubutin

    Interceptors in CXF Bus

    chubutin Newbie

      Hello. Is there a way to set in/out cxf loggint interceptors for all the CXF web services deployed in Jboss Fuse? I don't want to configure one by one. So I expect to put the in out interceptor at the level of the cxf servlet. is that possible?


      I tried to modify the cxf.xml file inside the cxf-rt-core.jar in the folder /system/org/apache/cxf/cxf-rt-core/2.6.0.redhat-60024. This is my new configuration

      code




       

      <bean id="loggingInInterceptor" class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
      <bean id="logOutInterceptor" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>

       

      <bean id="cxf" class="org.apache.cxf.bus.spring.SpringBus" destroy-method="shutdown">
      <property name="outInterceptors">
      <list>
      <ref bean="logOutInterceptor"/>
      </list>
      </property>
      <property name="inInterceptors">
      <list>
      <ref bean="loggingInInterceptor"/>
      </list>
      </property>
      </bean>

       

      But it doesn't take effect. I read in the CXF [1] that this is the way to configure the bus. May be I'm wrong, can anyoue tell me if this is the way?

       

       

      [1] http://cxf.apache.org/docs/cxf-architecture.html

       

       

      PS: sorry for double posting. The same post is in http://fusesource.com/forums/thread.jspa?threadID=4931&tstart=0 but later I saw the last post was Apriel 8.

        • 1. Re: Interceptors in CXF Bus
          chubutin Newbie

          CXF needs one property to configure all the CXF Buses that it creates when a CXF service is deployed. That property is

           

          org.apache.cxf.logging.enabled=true

           

          And you should put in system.properties

           

          This is the solution I found

           

           

           

          With this solution, the In request is logged as

           

          ----------------------------

          ID: 2

          Address: http://localhost:8181/cxf/serviceImpl

          Encoding: UTF-8

          Http-Method: POST

          Content-Type: text/xml;charset=UTF-8

          Headers: {accept-encoding=[gzip,deflate], connection=[keep-alive], Content-Length=[294], content-type=[text/xml;charset=UTF-8], Host=[localhost:8181], SOAPAction=[""], User-Agent=[Apache-HttpClient/4.1.1 (java 1.5)]}

          Payload: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ves="http://service.esb.com/">

             <soapenv:Header/>

             <soapenv:Body>

                <ves:visitorName>

                   <name>2015</name>

                </ves:visitorName>

             </soapenv:Body>

          </soapenv:Envelope>

          --------------------------------------

           

           

           

           

          And the out

           

           

          ---------------------------

          ID: 2

          Response-Code: 200

          Encoding: UTF-8

          Content-Type: text/xml

          Headers: {accept-encoding=[gzip,deflate], breadcrumbId=[ID-fluxit-ntb-43-48345-1407863723188-2-2], dynamicRouteByOperation=[direct:getserviceGET], Expires=[Wed, 31 Dec 1969 21:00:00 ART], Host=[localhost:8181], Server=[Apache-Coyote/1.1], Set-Cookie=[JSESSIONID=1C52CF757DE8385DCB829D8E7F572F55.tomcat2; Path=/apex], User-Agent=[Apache-HttpClient/4.1.1 (java 1.5)]}

          Payload: <?xml version="1.0" encoding="UTF-8"?>

          <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

             <soap:Body>

                <ns2:getVisitByNameResponse xmlns:ns2="http://service.esb.com/">

                   <vesselVisitor>

                      <eta>2014-05-14T12:00:00-03:00</eta>

                      <etd>2014-06-15T12:00:00-03:00</etd>

                      <id>173</id>

                      <inboundVyg>000</inboundVyg>

                      <line>BOEDO</line>

                      <outboundVyg>000</outboundVyg>

                      <service>STG</service>

                      <name>2015</name>

                      <visit>2015</visit>

                   </vesselVisitor>

                </ns2:getVisitByNameResponse>

             </soap:Body>

          </soap:Envelope>

          --------------------------------------