[ 
https://issues.apache.org/jira/browse/AXIS2-5694?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andreas Veithen resolved AXIS2-5694.
------------------------------------
       Resolution: Fixed
         Assignee: Andreas Veithen
    Fix Version/s: 1.8.0

> axis2 reading DataHandler in client ws causing: 
> DataHandler.getorg.apache.axiom.om.OMException: java.io.IOException: 
> Attempted read on closed stream.
> -----------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-5694
>                 URL: https://issues.apache.org/jira/browse/AXIS2-5694
>             Project: Axis2
>          Issue Type: Bug
>          Components: adb, client-api
>    Affects Versions: 1.6.2, 1.6.4, 1.7.0
>            Reporter: Daniel Minder
>            Assignee: Andreas Veithen
>              Labels: axis2_1.6.2
>             Fix For: 1.8.0
>
>
> I use MTOM to send files back and forward. I use the DataHandler. On one 
> side: 
>                     File serverFile = new File(finalPath.toString());
>                     DataSource serverDs = new FileDataSource(serverFile);;
>                     dh = new DataHandler(serverDs);
>                     return new.RetrFileResponse().setRetrFileResponse(dh);
> ... on the other side:
>               OutputStream os = new FileOutputStream(new File("C:/TEMP/" + 
> finalFileName));
>               OMAbstractFactory.getOMFactory());
>               DataSource ds = rfr.getRetrFileResponse().getDataSource();
>               rfr.getRetrFileResponse().writeTo(os);
>                       os.flush();
>                       os.close();
> It works perfectly well in the upload service (client to server). 
> But the download version (server to client) makes the above mentioned 
> exception (on the call '.getDataSource()').
> Maybe it is related to jira issues: 
> https://issues.apache.org/jira/browse/AXIS2-5487
> https://issues.apache.org/jira/browse/AXIS2-5469
> ? If yes, where can I get Axis 1.7? Seems not to be downloadable yet?
> If not, how can I keep the stream open? And anyway, the datas should be in 
> the soap message! So I don't see why it can't retrieve the datas though the 
> stream is closed on the server!
> Can anybody help me please? I'd love to give further information!
> Here is the whole exception stack:
> ERROR [JHttp-38] 2015-04-09 20:39:24.317 ERROR
> org.apache.axiom.om.OMException: java.io.IOException: Attempted read on 
> closed stream.
>       at 
> org.apache.axiom.attachments.PartContentFactory.createPartContent(PartContentFactory.java:153)
>  ~[axiom-api-1.2.13.jar:1.2.13]
>       at org.apache.axiom.attachments.PartImpl.fetch(PartImpl.java:176) 
> ~[axiom-api-1.2.13.jar:1.2.13]
>       at org.apache.axiom.attachments.PartImpl.getContent(PartImpl.java:149) 
> ~[axiom-api-1.2.13.jar:1.2.13]
>       at 
> org.apache.axiom.attachments.PartImpl.getDataSource(PartImpl.java:234) 
> ~[axiom-api-1.2.13.jar:1.2.13]
>       at 
> org.apache.axiom.attachments.PartDataHandler.getDataSource(PartDataHandler.java:50)
>  ~[axiom-api-1.2.13.jar:1.2.13]
>       at 
> com.iflow.ws.server.octipus.WsOctiHello.testServiceRetrFile(WsOctiHello.java:571)
>  ~[octipus.jar:na]
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
> ~[na:1.7.0_75]
>       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 
> ~[na:1.7.0_75]
>       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
> ~[na:1.7.0_75]
>       at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.7.0_75]
>       at com.groiss.servlet.Dispatcher.service(Dispatcher.java:394) 
> ~[ep.jar:9.0.18382]
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) 
> [javax.servlet-api.jar:3.1.0]
>       at 
> org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808) 
> [jetty-servlet-9.2.9.v20150224.jar:9.2.9.v20150224]
>       at 
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)
>  [jetty-servlet-9.2.9.v20150224.jar:9.2.9.v20150224]
>       at 
> com.planetj.servlet.filter.compression.CompressingFilter.doFilter(CompressingFilter.java:293)
>  [pjl-comp-filter-1.8.1.jar:na]
>       at 
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
>  [jetty-servlet-9.2.9.v20150224.jar:9.2.9.v20150224]
>       at 
> net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:198) 
> [javamelody-1.53.0.jar:na]
>       at 
> net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:176) 
> [javamelody-1.53.0.jar:na]
>       at 
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
>  [jetty-servlet-9.2.9.v20150224.jar:9.2.9.v20150224]
>       at 
> org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:224)
>  [websocket-server-9.2.9.v20150224.jar:9.2.9.v20150224]
>       at 
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
>  [jetty-servlet-9.2.9.v20150224.jar:9.2.9.v20150224]
>       at 
> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585) 
> [jetty-servlet-9.2.9.v20150224.jar:9.2.9.v20150224]
>       at 
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) 
> [jetty-server-9.2.9.v20150224.jar:9.2.9.v20150224]
>       at 
> org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577) 
> [jetty-security-9.2.9.v20150224.jar:9.2.9.v20150224]
>       at 
> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
>  [jetty-server-9.2.9.v20150224.jar:9.2.9.v20150224]
>       at 
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
>  [jetty-server-9.2.9.v20150224.jar:9.2.9.v20150224]
>       at 
> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) 
> [jetty-servlet-9.2.9.v20150224.jar:9.2.9.v20150224]
>       at 
> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
>  [jetty-server-9.2.9.v20150224.jar:9.2.9.v20150224]
>       at 
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
>  [jetty-server-9.2.9.v20150224.jar:9.2.9.v20150224]
>       at 
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) 
> [jetty-server-9.2.9.v20150224.jar:9.2.9.v20150224]
>       at 
> org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52) 
> [jetty-server-9.2.9.v20150224.jar:9.2.9.v20150224]
>       at 
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
>  [jetty-server-9.2.9.v20150224.jar:9.2.9.v20150224]
>       at org.eclipse.jetty.server.Server.handle(Server.java:497) 
> [jetty-server-9.2.9.v20150224.jar:9.2.9.v20150224]
>       at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310) 
> [jetty-server-9.2.9.v20150224.jar:9.2.9.v20150224]
>       at 
> org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) 
> [jetty-server-9.2.9.v20150224.jar:9.2.9.v20150224]
>       at 
> org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540) 
> [jetty-io-9.2.9.v20150224.jar:9.2.9.v20150224]
>       at 
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
>  [jetty-util-9.2.9.v20150224.jar:9.2.9.v20150224]
>       at 
> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
>  [jetty-util-9.2.9.v20150224.jar:9.2.9.v20150224]
>       at java.lang.Thread.run(Unknown Source) [na:1.7.0_75]
> Caused by: java.io.IOException: Attempted read on closed stream.
>       at 
> org.apache.commons.httpclient.AutoCloseInputStream.isReadAllowed(AutoCloseInputStream.java:183)
>  ~[commons-httpclient-3.1.jar:na]
>       at 
> org.apache.commons.httpclient.AutoCloseInputStream.read(AutoCloseInputStream.java:107)
>  ~[commons-httpclient-3.1.jar:na]
>       at java.io.FilterInputStream.read(Unknown Source) ~[na:1.7.0_75]
>       at 
> org.apache.axiom.om.util.DetachableInputStream.read(DetachableInputStream.java:147)
>  ~[axiom-api-1.2.13.jar:1.2.13]
>       at 
> org.apache.james.mime4j.io.BufferedLineReaderInputStream.fillBuffer(BufferedLineReaderInputStream.java:111)
>  ~[apache-mime4j-core-0.7.2.jar:0.7.2]
>       at 
> org.apache.james.mime4j.io.MimeBoundaryInputStream.fillBuffer(MimeBoundaryInputStream.java:223)
>  ~[apache-mime4j-core-0.7.2.jar:0.7.2]
>       at 
> org.apache.james.mime4j.io.MimeBoundaryInputStream.read(MimeBoundaryInputStream.java:157)
>  ~[apache-mime4j-core-0.7.2.jar:0.7.2]
>       at 
> org.apache.james.mime4j.io.BufferedLineReaderInputStream.fillBuffer(BufferedLineReaderInputStream.java:111)
>  ~[apache-mime4j-core-0.7.2.jar:0.7.2]
>       at 
> org.apache.james.mime4j.io.BufferedLineReaderInputStream.read(BufferedLineReaderInputStream.java:158)
>  ~[apache-mime4j-core-0.7.2.jar:0.7.2]
>       at 
> org.apache.james.mime4j.io.LineReaderInputStreamAdaptor.read(LineReaderInputStreamAdaptor.java:67)
>  ~[apache-mime4j-core-0.7.2.jar:0.7.2]
>       at java.io.FilterInputStream.read(Unknown Source) ~[na:1.7.0_75]
>       at 
> org.apache.axiom.attachments.impl.BufferUtils.inputStream2FileOutputStream(BufferUtils.java:183)
>  ~[axiom-api-1.2.13.jar:1.2.13]
>       at 
> org.apache.axiom.attachments.impl.BufferUtils.inputStream2OutputStream(BufferUtils.java:69)
>  ~[axiom-api-1.2.13.jar:1.2.13]
>       at 
> org.apache.axiom.attachments.PartContentOnFile.<init>(PartContentOnFile.java:62)
>  ~[axiom-api-1.2.13.jar:1.2.13]
>       at 
> org.apache.axiom.attachments.PartContentFactory.createPartContent(PartContentFactory.java:134)
>  ~[axiom-api-1.2.13.jar:1.2.13]
>       ... 38 common frames omitted
> ... and here is the wsdl; upladFile is working perfectly. retrFile is not!
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <wsdl:definitions
>       xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
>       xmlns:tns="http://.../";
>       xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
>       xmlns:xsd="http://www.w3.org/2001/XMLSchema";
>       targetNamespace="http://.../";>
>   <wsdl:types>
>     <xsd:schema targetNamespace="http://.../";
>     xmlns:xmime="http://www.w3.org/2005/05/xmlmime";>
>       <xsd:element name="SayHelloRequest">
>         <xsd:complexType>
>           <xsd:sequence>
>             <xsd:element name="firstname"  minOccurs="0" maxOccurs="1" 
> type="xsd:string"/>
>             <xsd:element name="lastname"  minOccurs="0" maxOccurs="1" 
> type="xsd:string"/>
>           </xsd:sequence>
>         </xsd:complexType>
>       </xsd:element>
>       <xsd:element name="SayHelloResponse">
>         <xsd:complexType>
>           <xsd:sequence>
>             <xsd:element name="responseMsg" type="xsd:string"/>
>           </xsd:sequence>
>         </xsd:complexType>
>       </xsd:element>
>         <xsd:element name="MoveFileRequest">
>         <xsd:complexType>
>           <xsd:sequence>
>             <xsd:element name="fileName"  minOccurs="0" maxOccurs="1" 
> type="xsd:string"/>
>             <xsd:element name="filePath"  minOccurs="0" maxOccurs="1" 
> type="xsd:string"/>
>           </xsd:sequence>
>         </xsd:complexType>
>       </xsd:element>
>       <xsd:element name="MoveFileResponse">
>         <xsd:complexType>
>           <xsd:sequence>
>                       <xsd:element name="responseFile"  minOccurs="0" 
> maxOccurs="1" type="xsd:base64Binary"/>
>                       <xsd:element name="responseCode"  type="xsd:int"/>
>                       <xsd:element name="errorMsg" type="xsd:string"/>
>           </xsd:sequence>
>         </xsd:complexType>
>       </xsd:element>
>         <xsd:element name="RetrFileRequest">
>         <xsd:complexType>
>           <xsd:sequence>
>             <xsd:element name="fileName"  minOccurs="0" maxOccurs="1" 
> type="xsd:string"/>
>             <xsd:element name="filePath"  minOccurs="0" maxOccurs="1" 
> type="xsd:string"/>
>           </xsd:sequence>
>         </xsd:complexType>
>       </xsd:element>
>       <xsd:element name="RetrFileResponse" type="xsd:base64Binary"/>
>         <xsd:element name="UploadFileRequest">
>         <xsd:complexType>
>           <xsd:sequence>
>               <xsd:element name="payload"  minOccurs="0" maxOccurs="1" 
> type="xsd:base64Binary"/>
>             <xsd:element name="fileName"  minOccurs="0" maxOccurs="1" 
> type="xsd:string"/>
>           </xsd:sequence>
>         </xsd:complexType>
>       </xsd:element>
>       <xsd:element name="UploadFileResponse">
>         <xsd:complexType>
>           <xsd:sequence>
>                       <xsd:element name="responseCode"  type="xsd:int"/>
>                       <xsd:element name="errorMsg" type="xsd:string"/>
>           </xsd:sequence>
>         </xsd:complexType>
>       </xsd:element>
>     </xsd:schema>
>   </wsdl:types>
>   <wsdl:message name="SayHelloInput">
>     <wsdl:part element="tns:SayHelloRequest" name="parameters"/>
>   </wsdl:message>
>   <wsdl:message name="SayHelloOutput">
>     <wsdl:part element="tns:SayHelloResponse" name="parameters"/>
>   </wsdl:message>
>   <wsdl:message name="MoveFileInput">
>     <wsdl:part element="tns:MoveFileRequest" name="parameters"/>
>   </wsdl:message>
>   <wsdl:message name="MoveFileOutput">
>     <wsdl:part element="tns:MoveFileResponse" name="parameters"/>
>   </wsdl:message>
>   <wsdl:message name="RetrFileInput">
>     <wsdl:part element="tns:RetrFileRequest" name="parameters"/>
>   </wsdl:message>
>   <wsdl:message name="RetrFileOutput">
>     <wsdl:part element="tns:RetrFileResponse" name="parameters"/>
>   </wsdl:message>
>     <wsdl:message name="UploadFileInput">
>     <wsdl:part element="tns:UploadFileRequest" name="parameters"/>
>   </wsdl:message>
>   <wsdl:message name="UploadFileOutput">
>     <wsdl:part element="tns:UploadFileResponse" name="parameters"/>
>   </wsdl:message>
>   <wsdl:portType name="OctiHelloPort">
>     <wsdl:operation name="sayHello">
>       <wsdl:input message="tns:SayHelloInput"/>
>       <wsdl:output message="tns:SayHelloOutput"/>
>     </wsdl:operation>
>     <wsdl:operation name="moveFile">
>       <wsdl:input message="tns:MoveFileInput"/>
>       <wsdl:output message="tns:MoveFileOutput"/>
>     </wsdl:operation>
>     <wsdl:operation name="retrFile">
>       <wsdl:input message="tns:RetrFileInput"/>
>       <wsdl:output message="tns:RetrFileOutput"/>
>     </wsdl:operation>
>     <wsdl:operation name="uploadFile">
>       <wsdl:input message="tns:UploadFileInput"/>
>       <wsdl:output message="tns:UploadFileOutput"/>
>     </wsdl:operation>
>   </wsdl:portType>
>   <wsdl:binding name="OctiHelloSOAPBinding" type="tns:OctiHelloPort">
>     <soap:binding style="document" 
> transport="http://schemas.xmlsoap.org/soap/http"/>
>     <wsdl:operation name="sayHello">
>       <soap:operation soapAction="http://.../sayHello"/>
>       <wsdl:input>
>         <soap:body use="literal"/>
>       </wsdl:input>
>       <wsdl:output>
>         <soap:body use="literal"/>
>       </wsdl:output>
>     </wsdl:operation>
>     <wsdl:operation name="moveFile">
>       <soap:operation soapAction="http://.../moveFile"/>
>       <wsdl:input>
>         <soap:body use="literal"/>
>       </wsdl:input>
>       <wsdl:output>
>         <soap:body use="literal"/>
>       </wsdl:output>
>     </wsdl:operation>
>     <wsdl:operation name="uploadFile">
>       <soap:operation soapAction="http://.../uploadFile"/>
>       <wsdl:input>
>         <soap:body use="literal"/>
>       </wsdl:input>
>       <wsdl:output>
>         <soap:body use="literal"/>
>       </wsdl:output>
>     </wsdl:operation>
>     <wsdl:operation name="retrFile">
>       <soap:operation soapAction="http://.../retrFile"/>
>       <wsdl:input>
>         <soap:body use="literal"/>
>       </wsdl:input>
>       <wsdl:output>
>         <soap:body use="literal"/>
>       </wsdl:output>
>     </wsdl:operation>
>   </wsdl:binding>
>   <wsdl:service name="OctiHelloService">
>       <wsdl:port binding="tns:OctiHelloSOAPBinding" name="OctiHelloSOAP">
>       <soap:address 
> location="http://localhost:8180/wf/services.axis2/OctiHelloService"/>
>     </wsdl:port>
>   </wsdl:service>
> </wsdl:definitions>



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to