Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CXF interceptors only for client using configuration

I have added interceptor only in cxf_client.xml but same interceptor are invoking for incoming apis as well(i.e cxf_server). below are my changes. Can some one please tell me why this interceptor are invoking for incoming APIs? is it because same bus use for both server and client?

cxf_client.xml

  <bean id="XCustomInterceptor" class="com.test.XCustomInterceptor"/>
<cxf:bus>
        <cxf:inInterceptors>
            <ref bean="XCustomInterceptor"/>
        </cxf:inInterceptors>
        <cxf:outInterceptors>
            <ref bean="XCustomInterceptor"/>
       </cxf:outInterceptors>
    </cxf:bus>*
like image 920
user5417198 Avatar asked Jan 22 '26 19:01

user5417198


1 Answers

Because you are using

<cxf:inInterceptors>
     <ref bean="XCustomInterceptor"/>
</cxf:inInterceptors>

Check documentation http://cxf.apache.org/docs/bus-configuration.html

inInterceptors The interceptors contributed to inbound message interceptor chains. A list of s or s

You can use specific interceptors for inbound connection and outbound connections in server and cliente

For example, here it is the configuration of a jax-ws endpoint and client with in and out interceptors

<!-- The SOAP endpoint --> 
<jaxws:endpoint
   id="helloWorld"
   implementor="demo.spring.HelloWorldImpl"
   address="http://localhost/HelloWorld">
   <jaxws:inInterceptors>
      <ref bean="customInInterceptor"/>
    </jaxws:inInterceptors>
   <jaxws:outInterceptors>
      <ref bean="customOutInterceptor"/>
   </jaxws:outInterceptors>

</jaxws:endpoint>

<!-- The SOAP client bean -->
<jaxws:client id="helloClient"
            serviceClass="demo.spring.HelloWorld"
            address="http://localhost/HelloWorld">
    <jaxws:inInterceptors>
        <ref bean="customClientInInterceptor"/>
    </jaxws:inInterceptors>
    <jaxws:outInterceptors>
        <ref bean="customClientOutInterceptor"/>
    </jaxws:outInterceptors>
 </jaxws:client>
like image 83
pedrofb Avatar answered Jan 25 '26 07:01

pedrofb



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!