"Attempted read on closed stream"

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

"Attempted read on closed stream"

Hsu, Ryan
Hi All,

We are using the Axis2 client and trying to accomplish a simple task of getting the raw xml response from a web service call. By doing:

                stub._getServiceClient().getLastOperationContext().getMessageContext("In").getEnvelope().toString();

we are receiving:

                "WstxIOException: Attempted read on closed stream"

I have also included a full stack trace below. My question is, is there an alternative way to get the raw xml if I have only access to the client?

Thank you,

Ryan



org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxIOException: Attempted read on closed stream.
        at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:260)
        at org.apache.axiom.om.impl.llom.OMElementImpl.getNextOMSibling(OMElementImpl.java:337)
        at org.apache.axiom.om.impl.traverse.OMChildrenIterator.next(OMChildrenIterator.java:102)
        at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:953)
        at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:937)
        at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:227)
        at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:937)
        at org.apache.axiom.om.impl.llom.OMNodeImpl.serialize(OMNodeImpl.java:387)
        at org.apache.axiom.om.impl.llom.OMElementImpl.toString(OMElementImpl.java:1106)
        at Main.main(Main.java:53)
Caused by: com.ctc.wstx.exc.WstxIOException: Attempted read on closed stream.
        at com.ctc.wstx.sr.StreamScanner.throwFromIOE(StreamScanner.java:683)
        at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1086)
        at javax.xml.stream.util.StreamReaderDelegate.next(StreamReaderDelegate.java:88)
        at org.apache.axiom.om.impl.builder.SafeXMLStreamReader.next(SafeXMLStreamReader.java:183)
        at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:597)
        at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:172)
        ... 9 more
Caused by: java.io.IOException: Attempted read on closed stream.
        at org.apache.commons.httpclient.AutoCloseInputStream.isReadAllowed(AutoCloseInputStream.java:183)
        at org.apache.commons.httpclient.AutoCloseInputStream.read(AutoCloseInputStream.java:107)
        at java.io.FilterInputStream.read(FilterInputStream.java:133)
        at org.apache.axiom.om.util.DetachableInputStream.read(DetachableInputStream.java:147)
        at java.io.FilterInputStream.read(FilterInputStream.java:133)
        at java.io.PushbackInputStream.read(PushbackInputStream.java:186)
        at java.io.FilterInputStream.read(FilterInputStream.java:107)
        at com.ctc.wstx.io.UTF8Reader.loadMore(UTF8Reader.java:365)
        at com.ctc.wstx.io.UTF8Reader.read(UTF8Reader.java:110)
        at com.ctc.wstx.io.MergedReader.read(MergedReader.java:101)
        at com.ctc.wstx.io.ReaderSource.readInto(ReaderSource.java:84)
        at com.ctc.wstx.io.BranchingReaderSource.readInto(BranchingReaderSource.java:57)
        at com.ctc.wstx.sr.StreamScanner.loadMore(StreamScanner.java:967)
        at com.ctc.wstx.sr.StreamScanner.getNext(StreamScanner.java:738)
        at com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2721)
        at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1019)
        ... 13 more
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: "Attempted read on closed stream"

Kishanthan Thangarajah


On Mon, Jan 7, 2013 at 10:02 PM, Hsu, Ryan <[hidden email]> wrote:
Hi All,

We are using the Axis2 client and trying to accomplish a simple task of getting the raw xml response from a web service call. By doing:

                stub._getServiceClient().getLastOperationContext().getMessageContext("In").getEnvelope().toString();

Can you take a look at [1]. It is a similar requirement as yours. The reason and some workarounds are mentioned in that jira itself.

Thanks,
Kishanthan.

we are receiving:

                "WstxIOException: Attempted read on closed stream"

I have also included a full stack trace below. My question is, is there an alternative way to get the raw xml if I have only access to the client?

Thank you,

Ryan



org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxIOException: Attempted read on closed stream.
        at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:260)
        at org.apache.axiom.om.impl.llom.OMElementImpl.getNextOMSibling(OMElementImpl.java:337)
        at org.apache.axiom.om.impl.traverse.OMChildrenIterator.next(OMChildrenIterator.java:102)
        at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:953)
        at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:937)
        at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:227)
        at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:937)
        at org.apache.axiom.om.impl.llom.OMNodeImpl.serialize(OMNodeImpl.java:387)
        at org.apache.axiom.om.impl.llom.OMElementImpl.toString(OMElementImpl.java:1106)
        at Main.main(Main.java:53)
Caused by: com.ctc.wstx.exc.WstxIOException: Attempted read on closed stream.
        at com.ctc.wstx.sr.StreamScanner.throwFromIOE(StreamScanner.java:683)
        at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1086)
        at javax.xml.stream.util.StreamReaderDelegate.next(StreamReaderDelegate.java:88)
        at org.apache.axiom.om.impl.builder.SafeXMLStreamReader.next(SafeXMLStreamReader.java:183)
        at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:597)
        at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:172)
        ... 9 more
Caused by: java.io.IOException: Attempted read on closed stream.
        at org.apache.commons.httpclient.AutoCloseInputStream.isReadAllowed(AutoCloseInputStream.java:183)
        at org.apache.commons.httpclient.AutoCloseInputStream.read(AutoCloseInputStream.java:107)
        at java.io.FilterInputStream.read(FilterInputStream.java:133)
        at org.apache.axiom.om.util.DetachableInputStream.read(DetachableInputStream.java:147)
        at java.io.FilterInputStream.read(FilterInputStream.java:133)
        at java.io.PushbackInputStream.read(PushbackInputStream.java:186)
        at java.io.FilterInputStream.read(FilterInputStream.java:107)
        at com.ctc.wstx.io.UTF8Reader.loadMore(UTF8Reader.java:365)
        at com.ctc.wstx.io.UTF8Reader.read(UTF8Reader.java:110)
        at com.ctc.wstx.io.MergedReader.read(MergedReader.java:101)
        at com.ctc.wstx.io.ReaderSource.readInto(ReaderSource.java:84)
        at com.ctc.wstx.io.BranchingReaderSource.readInto(BranchingReaderSource.java:57)
        at com.ctc.wstx.sr.StreamScanner.loadMore(StreamScanner.java:967)
        at com.ctc.wstx.sr.StreamScanner.getNext(StreamScanner.java:738)
        at com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2721)
        at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1019)
        ... 13 more
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]