Since Xfire is stax based it never caches the whole message in memory , but luckily there were options to configure to log the whole in/out messages.
First we need to add a DOMInHandler to the request flow. It reads the incoming stream to a DOM document and sets the stream to a W3CDOMStreamReader.Then use LoggingHandler to log the message.
Same approach can be used for the out going messages using , DOMOutHandler and LoggingHandler.
//Tell XFire to cache a DOM document for the various in/out flowsservice.addInHandler(new org.codehaus.xfire
.util.dom.DOMInHandler()); service.addOutHandler(new org.codehaus.xfire
.util.dom.DOMOutHandler()); // Add a logging handler to each flow
service.addInHandler(new org.codehaus.xfire
.util.LoggingHandler()); service.addOutHandler(new org.codehaus.xfire
.util.LoggingHandler());In the XML config looks like :
<bean id="sampleWS"<br />
class="org.codehaus.xfire.spring.remoting.XFireExporter"<br />
abstract="true"><br />
<property name="style" value="document" /><br />
<property name="serviceFactory" ref="bindingServiceFactory" /><br />
<property name="namespace" value="http://sample.com" /><br />
<property name="xfire" ref="xfire" /><br />
<property name="inHandlers"><br />
<list><br />
<ref bean="inHandler" /><br />
<ref bean="loggingHandler" /><br />
</list><br />
</property><br />
<property name="outHandlers"><br />
<list><br />
<ref bean="outHandler" /><br />
<ref bean="loggingHandler" /><br />
</list><br />
</property><br />
<br />
</bean><br />
<br />
<br />
<bean id="inHandler"<br />
class="org.codehaus.xfire.util.dom.DOMInHandler"<br />
scope="prototype" /><br />
<br />
<bean id="outHandler"<br />
class="org.codehaus.xfire.util.dom.DOMOutHandler"<br />
scope="prototype" /><br />
<br />
<bean id="loggingHandler"<br />
class="org.codehaus.xfire.util.LoggingHandler"<br />
scope="prototype" />
No comments:
Post a Comment