0

我的问题是我必须使用不同的服务并且: 1. 在我的 beans.xml 中有这个

<cxf:bus >
        <cxf:features>
            <cxf:logging/>
        </cxf:features>

    </cxf:bus>

这在 log4.xml 中:

 <logger name="org.apache.cxf" additivity="false">
    <level value="info" />
    <appender-ref ref="sessionSoapFile" />
    <appender-ref ref="console" />
</logger>

我可以从我的所有服务客户之一看到我的控制台只有肥皂。我不明白为什么。可以添加正确声明的写入日志的服务,如下所示:

<jaxws:client id="sessionService" address="${session-storage.url}/services/SessionService?wsdl" serviceClass="ru.vtsft.exchange.session.service.SessionService">
    <jaxws:dataBinding>
        <bean class="org.apache.cxf.aegis.databinding.AegisDatabinding" />
    </jaxws:dataBinding>
</jaxws:client>

和不喜欢这样的服务:

<bean id="agencyClient" class="comtech.swc.service.AgencyService"
        factory-bean="agencyFactory" factory-method="create" />

    <bean id="agencyFactory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
        <property name="serviceClass" value="comtech.swc.service.AgencyService" />
        <property name="address" value="${swc.url}/agency" />
        <property name="outInterceptors">
            <list>
                <bean class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor" />
                <ref bean="authorizationOutInterceptor" />
                <bean class="ru.vtsft.exchange.cxfinterceptors.DynamicIdOutInterceptor" />
            </list>
        </property>
    </bean>

结果,我想在不同的文件中写入来自不同服务的肥皂日志。谢谢你的建议,对不起我的英语=)

4

1 回答 1

1

好的,昨晚我收到了!cxf 不会为第二种类型的客户端编写日志,因为我覆盖了他自己的拦截器。解决方案是:

<bean id="exchangeFactory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
        <property name="serviceClass" value="comtech.swc.service.ExchangeService" />
        <property name="address" value="${swc.url}/exchange" />
        <property name="inInterceptors">
            <list>
                <ref bean="loggingInInterceptor" /> <!---- Here -->
            </list>
        </property>
        <property name="outInterceptors">
            <list>
                <ref bean="loggingOutInterceptor" /> <!---- And here -->
                <bean class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor" />
                <ref bean="authorizationOutInterceptor" />
                <bean class="ru.vtsft.exchange.cxfinterceptors.DynamicIdOutInterceptor" />
            </list>
        </property>
    </bean>

 <!-- Logging interceptors -->
 <bean id="loggingInInterceptor" class="org.apache.cxf.interceptor.LoggingInInterceptor" />
 <bean id="loggingOutInterceptor" class="org.apache.cxf.interceptor.LoggingOutInterceptor" />

感谢您的关注=)

于 2012-09-07T05:08:47.320 回答