You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Robert Lazarski (Jira)" <ji...@apache.org> on 2020/12/06 16:00:00 UTC

[jira] [Commented] (AXIS2-5462) Axis2 MTOM client exception when downloading file from service to client [Error reading from source]

    [ https://issues.apache.org/jira/browse/AXIS2-5462?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17244762#comment-17244762 ] 

Robert Lazarski commented on AXIS2-5462:
----------------------------------------

The solution here is using the latest httpclient 4 version, which axis2 optionally supports by changing the axis2.xml:

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

 

> Axis2 MTOM client exception when downloading file from service to client [Error reading from source]
> ----------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-5462
>                 URL: https://issues.apache.org/jira/browse/AXIS2-5462
>             Project: Axis2
>          Issue Type: Bug
>          Components: adb, client-api, wsdl
>    Affects Versions: 1.6.2
>         Environment: OS: SL 6.2 kernel 2.6 apache-tomcat-7.0.28
>            Reporter: Guterl Patrick
>            Priority: Major
>              Labels: patch
>
> I am trying to upload and download large binary files with axis2 using MTOM. I am able to upload (from client to server) up to 2GB file without any memory issue either at server side or client side.iy(s work fine
>  But when downloading file from server to client, client is getting a exception clien side :Error reading from source
> When the response received at client side, javax.activation.Datahandler is embedded in the response which is a pointer to InputStream. 
> The exception java is up at the instruction 	ataHandler.writeTo(fileOutputStream); 		
> DataHandler dataHandler = getResponse.getFile().getBase64Binary();	
> FileOutputStream fileOutputStream = new FileOutputStream(f);
> if (dataHandler != null)	      dataHandler.writeTo(fileOutputStream); 
>  
> And this is the same mechanism while uploading, and there is no problem at that end.
> Seems to be a bug at client side ??
> server side
>    <parameter name="enableMTOM">true</parameter>
> printTrace exception
> org.apache.axiom.om.OMException: org.apache.axiom.ext.io.StreamCopyException: Error reading from source
> 	at org.apache.axiom.attachments.PartContentFactory.createPartContent(PartContentFactory.java:153)
> 	at org.apache.axiom.attachments.PartImpl.fetch(PartImpl.java:176)
> 	at org.apache.axiom.attachments.PartImpl.getContent(PartImpl.java:149)
> 	at org.apache.axiom.attachments.PartImpl.writeTo(PartImpl.java:238)
> 	at org.apache.axiom.attachments.PartDataHandler.writeTo(PartDataHandler.java:65)
> 	at iphc.wsdl.client.ClientImpl.handleGetResponse(ClientImpl.java:133)
> 	at ClientGetFile.main(ClientGetFile.java:39)
> Caused by: org.apache.axiom.ext.io.StreamCopyException: Error reading from source
> 	at org.apache.axiom.attachments.utils.BAAOutputStream.readFrom(BAAOutputStream.java:114)
> 	at org.apache.axiom.attachments.impl.BufferUtils.inputStream2OutputStream(BufferUtils.java:76)
> 	at org.apache.axiom.attachments.PartContentFactory.createPartContent(PartContentFactory.java:119)
> 	... 6 more
> 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.attachments.utils.BAAOutputStream.readFrom(BAAOutputStream.java:112)
> 	... 8 more
> thank's



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org