I created a logging module that is similar to the one described at
http://ws.apache.org/axis2/1_3/modules.html. I engage the logging module
for my client like this:
ConfigurationContext ctx =
ConfigurationContextFactory.createConfigurationContextFromFileSystem(pathToRepo,null);
ctx.getAxisConfiguration().engageModule("logging");
Phase loggingPhase = new Phase("loggingPhase");
ctx.getAxisConfiguration().getGlobalOutPhases().add(0,loggingPhase);
ctx.getAxisConfiguration().getGlobalInFlow().add(loggingPhase);
ctx.getAxisConfiguration().getInFaultFlow().add(loggingPhase);
ctx.getAxisConfiguration().getOutFaultFlow().add(0,loggingPhase);
When the module goes to log the OutFlow of my SOAP message it successfully
logs it but it doesn't send the message because of the following exception:
java.lang.UnsupportedOperationException: The parser is already consumed!
at
org.apache.axiom.om.impl.llom.OMElementImpl.getXMLStreamReader(OMElementImpl.java:646)
at
org.apache.axiom.om.impl.llom.OMElementImpl.getXMLStreamReaderWithoutCaching(OMElementImpl.java:628)
at
org.apache.axiom.om.impl.llom.OMSourcedElementImpl.getXMLStreamReaderWithoutCaching(OMSourcedElementImpl.java:386)
at
org.apache.axiom.om.impl.util.OMSerializerUtil.serializeByPullStream(OMSerializerUtil.java:488)
at
org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:783)
at
org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:808)
at
org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(SOAPEnvelopeImpl.java:234)
at
org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:222)
at
org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:808)
at
org.apache.axiom.om.impl.llom.OMNodeImpl.serializeAndConsume(OMNodeImpl.java:418)
at
org.apache.axis2.transport.http.SOAPMessageFormatter.getBytes(SOAPMessageFormatter.java:77)
at
org.apache.axis2.transport.http.AxisRequestEntity.getContentLength(AxisRequestEntity.java:109)
at
org.apache.commons.httpclient.methods.EntityEnclosingMethod.getRequestContentLength(EntityEnclosingMethod.java:332)
at
org.apache.commons.httpclient.methods.EntityEnclosingMethod.addContentLengthRequestHeader(EntityEnclosingMethod.java:402)
at
org.apache.commons.httpclient.methods.EntityEnclosingMethod.addRequestHeaders(EntityEnclosingMethod.java:370)
at
org.apache.commons.httpclient.HttpMethodBase.writeRequestHeaders(HttpMethodBase.java:2036)
at
org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:1919)
at
org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:993)
at
org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)
at
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
at
org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:558)
at
org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:176)
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:73)
at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:305)
at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:201)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:452)
at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:330)
at
org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:294)
I believe what is happening has something to do with the following line of
code in my logging module:
msgContext.getEnvelope().toString()
What I am thinking is there maybe a different way in which I need to get the
SOAP Envelope to log? Any ideas?
Thanks,
Chad