Uploaded image for project: 'Axis2'
  1. Axis2
  2. AXIS2-4854

Cannot read IncomingAttachmentInputStream from Inbound Attachments

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.5.1
    • None
    • None
    • None

    Description

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

      }

      Attachments

        Activity

          People

            Unassigned Unassigned
            davewebb David Webb
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: