So I am trying to figure it out how could I enable logging via configuration 
file

Right now, I have following code

String address1 = "http://localhost:9000/service1";;
Service1 implementor1 = new Service1();EndpointImpl myEndpoint1 = 
(EndpointImpl)  Endpoint.publish(address1, implementor1);
        
myEndpoint1.getServer().getEndpoint().getInInterceptors().add(new 
LoggingInInterceptor());
myEndpoint1.getServer().getEndpoint().getOutInterceptors().add(new 
LoggingOutInterceptor());

JaxWsProxyFactoryBean factory1 = new JaxWsProxyFactoryBean();
factory1.setAddress("http://localhost:9000/service1";);
factory1.setServiceClass(IService1.class);        
IService1 client1 = (IService1) factory1.create();
SampleDTO data = client1.getSampleDTO();

And on my command prompt, I can see inbound and out bound sopa messages. So far 
so ood.

So now next step is I want to configure this logging via cxf.xml 

Now I created file src\main\resources\cxf.xml

and copied following snippet in that

<beans xmlns="http://www.springframework.org/schema/beans";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xsi:schemaLocation="
http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd";>

    <bean id="logInbound" 
class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
    <bean id="logOutbound" 
class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
    
    <bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl">
        <property name="inInterceptors">
            <list>
                <ref bean="logInbound"/>
            </list>
        </property>
        <property name="outInterceptors">
            <list>
                <ref bean="logOutbound"/>
            </list>
        </property>
        <property name="outFaultInterceptors">
            <list>
                <ref bean="logOutbound"/>
            </list>
        </property>
    </bean> 
</beans>

Now I am wondering how to load bean cxf in my code (It has to be referred some 
where in code, right ? And how could I direct log to some file instead of 
command prompt. 

And is there any good book/resource on cxf besides user guide on CXF site?

Thanks,

Petr V.







      

Reply via email to