WstxIOException on long base64Binary elements

Christoph Ludwig <[email protected]>
Newsgroups gmane.text.xml.axis.user,gmane.text.xml.commons.devel
Message-ID <[email protected]>
Hello,

my apologies for cross-posting, but I don't know if the problem we  
face is an Axiom or an Axis2 issue.

We have a Web Service that returns some data as an element of XML  
Schema type base64Binary. The data may be large. (We will eventually  
have to look into MTOM, but right now the data is embedded into the  
SOAP document.)

We prepared the client stub using Axis2's code generator (Axis2 1.3,  
sync style only). For some reasons, we preferred a stub without  
databinding, whence we handle Axiom's OMElements directly. Everything  
seemed to work out ok until the data we sent became large: Suddenly  
we encountered WstxIOExceptions ("Attempted read on closed stream")  
in the client code when we call reponse.getFirstElement().getText().  
Is there anything special you need to be aware of when accessing  
large text nodes via the OMElement interface?

I put the code for a test service and client with junit test on the  
web at <URL:http://festus.textgrid.it.fh-worms.de/misc/testcases/ 
Axis2_LargeBase64.zip>. It shows the error appears as soon as the  
string that is base64 encoded is longer than 2850 bytes. Then we get  
the attached stacktrace.

The catch is: If we generate the client with ADB binding, then it has  
no problems parsing long messages. (The zip file at the URL above  
contains also a testcase for the ADB binding that is analogous to the  
"purely OM based" test case.) We did not dissect and re-engineer the  
generated code in detail yet, but it is obviously possible to handle  
large data with Axiom.

Can anyone tell if we do something wrong in our code? Or is there a  
bug in Axiom or Axis2 that the ADB binding happens to work around?

We appreciate any help.
Regards

Christoph


---
FH Worms - University of Applied Sciences
Erenburgerstr. 19, 67549 Worms, Germany

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
Axis2_LargeBase64_Stacktrace.txt (text/plain, 3.4 KB)
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:239)
	at org.apache.axiom.om.impl.llom.OMElementImpl.buildNext(OMElementImpl.java:552)
	at org.apache.axiom.om.impl.llom.OMNodeImpl.getNextOMSibling(OMNodeImpl.java:134)
	at org.apache.axiom.om.impl.llom.OMElementImpl.getText(OMElementImpl.java:711)
	at test.axis2.lb64.client.om.junit.LB64OMTestCase.dummy(LB64OMTestCase.java:55)
	at test.axis2.lb64.client.om.junit.LB64OMTestCase.testDummy(LB64OMTestCase.java:71)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at junit.framework.TestCase.runTest(TestCase.java:164)
	at junit.framework.TestCase.runBare(TestCase.java:130)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:120)
	at junit.framework.TestSuite.runTest(TestSuite.java:230)
	at junit.framework.TestSuite.run(TestSuite.java:225)
	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
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 org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:153)
	... 23 more
Caused by: java.io.IOException: Attempted read on closed stream.
	at org.apache.commons.httpclient.AutoCloseInputStream.isReadAllowed(AutoCloseInputStream.java:165)
	at org.apache.commons.httpclient.AutoCloseInputStream.read(AutoCloseInputStream.java:106)
	at java.io.FilterInputStream.read(FilterInputStream.java:111)
	at java.io.PushbackInputStream.read(PushbackInputStream.java:161)
	at java.io.FilterInputStream.read(FilterInputStream.java:90)
	at com.ctc.wstx.io.UTF8Reader.loadMore(UTF8Reader.java:362)
	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.loadMoreFromCurrent(StreamScanner.java:1021)
	at com.ctc.wstx.sr.StreamScanner.loadMoreFromCurrent(StreamScanner.java:1028)
	at com.ctc.wstx.sr.StreamScanner.getNextCharFromCurrent(StreamScanner.java:786)
	at com.ctc.wstx.sr.BasicStreamReader.readEndElem(BasicStreamReader.java:3204)
	at com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2830)
	at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1019)
	... 24 more
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.