org.apache.axiom.om.OMException while reading answer of a soap request

Eddie <[email protected]> Tue, 21 May 2019 11:22:22 +0200
Newsgroups gmane.text.xml.axis.user
Message-ID <trinity-40d9fae2-30fd-4ea0-a87a-6a730cf923b2-1558430542196@3c-app-gmx-bs78>
Hi,

I am using a java client for accessing a SOAP service. As long as the expected answer is less than 4 kB I have no problems. But when the answer is larger (for this request, I have no problems reading larger binary data with other requests) I get the following exception:

org.apache.axiom.om.OMException: Failed to fetch the MIME part content

at org.apache.axiom.attachments.PartImpl.fetch(PartImpl.java:201)

at org.apache.axiom.attachments.PartImpl.getContent(PartImpl.java:152)

at org.apache.axiom.attachments.PartImpl.getDataSource(PartImpl.java:260)

at org.apache.axiom.attachments.PartDataHandler.getDataSource(PartDataHandler.java:50)

at javax.activation.DataHandler.getContent(DataHandler.java:542)

at ...GetHistory.getContentForStatus(GetHistory.java:179)

...

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 org.apache.james.mime4j.io.BufferedLineReaderInputStream.fillBuffer(BufferedLineReaderInputStream.java:111)

at org.apache.james.mime4j.io.MimeBoundaryInputStream.fillBuffer(MimeBoundaryInputStream.java:223)

at org.apache.james.mime4j.io.MimeBoundaryInputStream.read(MimeBoundaryInputStream.java:157)

at org.apache.james.mime4j.io.BufferedLineReaderInputStream.fillBuffer(BufferedLineReaderInputStream.java:111)

at org.apache.james.mime4j.io.BufferedLineReaderInputStream.read(BufferedLineReaderInputStream.java:158)

at org.apache.james.mime4j.io.LineReaderInputStreamAdaptor.read(LineReaderInputStreamAdaptor.java:67)

at org.apache.axiom.blob.MemoryBlobOutputStream.readFrom(MemoryBlobOutputStream.java:78)

at org.apache.axiom.blob.MemoryBlobImpl.readFrom(MemoryBlobImpl.java:64)

at org.apache.axiom.attachments.PartImpl.fetch(PartImpl.java:198)

... 7 more

The line causing the error is calling javax.activation.DataHandler.getContent()

Using tcpmon as proxy this is the answer:

HTTP/1.1 200 OK

Cache-Control: private

Server: Microsoft-IIS/8.5

MIME-Version: 1.0

X-AspNet-Version: 4.0.30319

X-LNIP-S: 2

Date: Tue, 21 May 2019 07:36:21 GMT

Transfer-Encoding: chunked

Content-Type: multipart/related; type="application/xop+xml";start="<http://tempuri.org/0>";boundary="uuid:32e56ec8-f450-4ac4-ab8b-cb28f9da4cf6+id=1";start-info="text/xml"

Connection: keep-alive

Proxy-Connection: keep-alive

16e4

--uuid:32e56ec8-f450-4ac4-ab8b-cb28f9da4cf6+id=1

Content-ID: <http://tempuri.org/0>

Content-Transfer-Encoding: 8bit

Content-Type: application/xop+xml;charset=utf-8;type="text/xml"

<s:Envelope ...</s:Envelope>

--uuid:32e56ec8-f450-4ac4-ab8b-cb28f9da4cf6+id=1

Content-ID: <http://tempuri.org/1/636940281811316362>

Content-Transfer-Encoding: binary

Content-Type: application/octet-stream

<DATA>

--uuid:32e56ec8-f450-4ac4-ab8b-cb28f9da4cf6+id=1--

0

I debugged into the call and found out that the exception is thrown in org.apache.axiom.blob.MemoryBlobOutputStream.readFrom. The first chunk (3914 bytes) is read but when trying to read the next chunk the exception is thrown.

I am using axis 2 version 1.79.

Am I doing something wrong here?

TIA for any help,

Eddie