3

cxf_client.xml にのみインターセプターを追加しましたが、同じインターセプターが着信 API (つまり cxf_server) も呼び出しています。以下は私の変更です。このインターセプターが着信 API を呼び出す理由を教えてください。 サーバーとクライアントの両方で同じバスを使用しているためですか?

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>*
4

1 に答える 1

1

使っているから

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

ドキュメントを確認してくださいhttp://cxf.apache.org/docs/bus-configuration.html

inInterceptors インターセプターは、受信メッセージ インターセプター チェーンに貢献しました。または のリスト

サーバーとクライアントのインバウンド接続とアウトバウンド接続に特定のインターセプターを使用できます

たとえば、これは jax-ws エンドポイントと、in および out インターセプターを使用したクライアントの構成です。

<!-- 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>
于 2016-06-11T10:07:12.097 に答える