You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Amila Suriarachchi <am...@gmail.com> on 2009/08/26 06:18:19 UTC

Re: [axis2] Parser already accessed! error when using logging module on client

On Wed, Aug 26, 2009 at 3:33 AM, Chad DeBauch <cd...@gmail.com> wrote:

> 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)


How you have written your client? can you send us the client code? It seems
it try to get the XMLStreamReader without caching in from a built soap
envelope. Normally we get xml stream reader like this at server side. But I
think Axiom does support this.

thanks,
Amila.

>
>     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
>



-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/

Re: [axis2] Parser already accessed! error when using logging module on client

Posted by Chad DeBauch <cd...@gmail.com>.
The client was written using WSDL2Java for Axis2.  I have attached the stub
code that it generated.  I did a string replace on some of the values
because parts of this web service are meant to be confidential.  Please let
me know if you need more information.

Thanks...Chad

On Tue, Aug 25, 2009 at 11:18 PM, Amila Suriarachchi <
amilasuriarachchi@gmail.com> wrote:

>
>
> On Wed, Aug 26, 2009 at 3:33 AM, Chad DeBauch <cd...@gmail.com> wrote:
>
>> 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)
>
>
> How you have written your client? can you send us the client code? It seems
> it try to get the XMLStreamReader without caching in from a built soap
> envelope. Normally we get xml stream reader like this at server side. But I
> think Axiom does support this.
>
> thanks,
> Amila.
>
>>
>>     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
>>
>
>
>
> --
> Amila Suriarachchi
> WSO2 Inc.
> blog: http://amilachinthaka.blogspot.com/
>