On Mon, May 20, 2019 at 11:22 PM Eddie <e...@gmx.net> wrote: > 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 > > --------------------------------------------------------------------- To > unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org For additional > commands, e-mail: java-user-h...@axis.apache.org
I notice you are running commons httpclient 3.x instead of 4.x, and somehow you are pulling in an Apache James mime lib which I don't recall axis2 shipping with. See the relevant section from my axis2.xml below. <transportSender name="http" class="org.apache.axis2.transport.http.impl.httpclient4.HTTPClient4TransportSender"> <parameter name="PROTOCOL">HTTP/1.1</parameter> <parameter name="Transfer-Encoding">chunked</parameter> <!-- If following is set to 'true', optional action part of the Content-Type will not be added to the SOAP 1.2 messages --> <!-- <parameter name="OmitSOAP12Action">true</parameter> --> </transportSender> <transportSender name="https" class="org.apache.axis2.transport.http.impl.httpclient4.HTTPClient4TransportSender"> <parameter name="PROTOCOL">HTTP/1.1</parameter> <parameter name="Transfer-Encoding">chunked</parameter> </transportSender> On the client side, you can turn off chunked and use content-length below, set to true to enable chunked. Since chunked data is often 4kb I expect you have a problem there somehow. I would also definitely make sure you are using httpclient4. Options option = client.getOptions(); option.setProperty(HTTPConstants.CHUNKED,false); Regards, Robert