Sometimes we have a senerio in which we need to log the request and response in DB or some where else, in order to see what request is sent to web service and what response we get. Apache CXF API provides us the facility to achieve this via using Interceptor (LoggingOutInterceptor and LoggingInInterceptor), by default these classes write the request and response in the System.out stream, Now if you want to store them to DB then you can't use this stream you must need data in some string variable , Therfore we need to change the write stream of Interceptor so that we can keep request and response in some string variable. String wsdlURL= "http://localhost:8084/MytestApp/artworkService"; JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); //Bind Service class factory.setServiceClass(MyService.class); //Bind WSDL factory.setAddress(wsdlURL); //Change logging strean Writer outResult = ne