Cannot read IncomingAttachmentInputStream from Inbound Attachments
------------------------------------------------------------------
Key: AXIS2-4854
URL: https://issues.apache.org/jira/browse/AXIS2-4854
Project: Axis2
Issue Type: Bug
Affects Versions: 1.5.1
Environment: WSDL2CODE 1.4.1 generated stubs
Running inside:
JBoss [The Oracle] 5.1.0.GA (build: SVNTag=JBoss_5_1_0_GA date=200905221634
Java version: 1.6.0_18,Sun Microsystems Inc.
Java Runtime: Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
Java VM: Java HotSpot(TM) 64-Bit Server VM 16.0-b13,Sun Microsystems Inc.
OS-System: Windows 7 6.1,amd64
VM arguments:
-agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:49743
-javaagent:C:\Program Files (x86)\ZeroTurnaround\JRebel\jrebel.jar
-Xverify:none -Drebel.struts1-plugin=true
-Dorg.apache.jasper.runtime.JspFactoryImpl.USE_POOL=false
-Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false
-Dprogram.name=run.bat
-Djava.endorsed.dirs=C:/jboss-5.1.0.GA/bin/../lib/endorsed -Xms1024m -Xmx1024m
-XX:NewRatio=3 -XX:PermSize=128m -XX:MaxPermSize=256m -Dfile.encoding=Cp1252
Axis2 1.5.1
Axiom 1.2.9
Reporter: David Webb
I am using Axis2 to call a webservice on jasperserver (Jasper Reports). The
web service that I am calling works fine with stub generated for Axis. I have
discovered this issue trying to upgrade all my clients to Axis2.
The webservice I am calling returns an attachment in the MessageContext with
the contentID of "jasperPrint". When I try to access this attachment using
either the attachments.getIncomingAttachmentStreams, or the
attachments.getDataHandler("jasperPrint"), I get the following Exception when
trying to read the input stream.
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:116)
at
org.apache.axiom.om.util.DetachableInputStream.read(DetachableInputStream.java:147)
at java.io.FilterInputStream.read(FilterInputStream.java:116)
at java.io.PushbackInputStream.read(PushbackInputStream.java:169)
at
org.apache.axiom.attachments.BoundaryDelimitedStream.readFromStream(BoundaryDelimitedStream.java:207)
at
org.apache.axiom.attachments.BoundaryDelimitedStream.read(BoundaryDelimitedStream.java:294)
at
org.apache.axiom.attachments.IncomingAttachmentInputStream.read(IncomingAttachmentInputStream.java:128)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
at java.io.FilterInputStream.read(FilterInputStream.java:90)
Here is the example code that generated the problem.
IncomingAttachmentStreams streams =
InContext.attachments.getIncomingAttachmentStreams();
boolean bFound = false;
while (streams != null &&
streams.isReadyToGetNextStream() && !bFound) {
IncomingAttachmentInputStream stream =
streams.getNextStream();
Log.write(this, DEBUG,
stream.getContentId());
if
(stream.getContentId().equals("<jasperPrint>")) {
DataHandler dh = new
DataHandler(new InputStreamDataSource(stream));
ObjectInputStream obj = new
ObjectInputStream(dh.getInputStream());
attach =
(JasperPrint)obj.readObject();
bFound = true;
}
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]