Hi Vivekananthan,

Seems your config is invalid. try the following.

Basically we should support both streaming and no streaming scenarios with
file connector.

Also make a jira and give a fix.

​
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse";
       name="fileconnectorRead"
       startOnLoad="true"
       statistics="disable"
       trace="disable"
       transports="https,http">
   <target>
      <inSequence>
         <property expression="json-eval($.address)" name="address"/>
         <property expression="json-eval($.append)" name="append"/>
         <property expression="json-eval($.source)" name="source"/>
         <property expression="json-eval($.contentType)"
name="contentType"/>
         <property expression="json-eval($.streaming)" name="streaming"/>
         <fileconnector.read>
            <source>{$ctx:source}</source>
            <contentType>{$ctx:contentType}</contentType>
            <streaming>{$ctx:streaming}</streaming>
         </fileconnector.read>
         <respond/>
      </inSequence>
   </target>
   <description/>
</proxy>
---------- Forwarded message ----------
From: Vivekananthan Sivanayagam <[email protected]>
Date: Tue, Nov 22, 2016 at 6:57 PM
Subject: File read with enabling streaming
To: Malaka Silva <[email protected]>


Hi ,

I checked the following scenario[1] with streaming enable, I am able
success with the response file. I tried 4GB file to send , it is working.
When I checked only FileRead operation with streaming, I was able to read
the content in the message context but could not build it the using
DataSourceMessageBuilder
with content type "application/file" and showing the following error.

Error

PassThroughHttpSender Failed to submit the response
java.lang.ClassCastException: com.sun.proxy.$Proxy21 cannot be cast to
org.wso2.carbon.relay.StreamingOnRequestDataSource


[1] Proxy:

​​
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse";
       name="fileconnectorRead"
       startOnLoad="true"
       statistics="disable"
       trace="disable"
       transports="https,http">
   <target>
      <inSequence>
         <property name="OUT_ONLY" value="true"/>
         <property action="remove"
                   name="ClientApiNonBlocking"
                   scope="axis2"
                   value="true"/>
         <property expression="json-eval($.address)" name="address"/>
         <property expression="json-eval($.append)" name="append"/>
         <property expression="json-eval($.source)" name="source"/>
         <property expression="json-eval($.contentType)"
name="contentType"/>
         <property expression="json-eval($.streaming)" name="streaming"/>
         <fileconnector.read>
            <source>{$ctx:source}</source>
            <contentType>{$ctx:contentType}</contentType>
            <streaming>{$ctx:streaming}</streaming>
         </fileconnector.read>
         <fileconnector.send>
            <address>{$ctx:address}</address>
            <append>{$ctx:append}</append>
         </fileconnector.send>
         <respond/>
      </inSequence>
   </target>
   <description/>
</proxy>

Request:

{
     "source":"/media/vive/vives/response.txt",
     "contentType":"application/file",
     "streaming":"true",
     "address":"/home/vive/Desktop/FILE/File002",
     "append":"true"
}


Vivekananthan Sivanayagam
Associate Software Engineer | WSO2
E:[email protected]
M:+94752786138



-- 

Best Regards,

Malaka Silva
Senior Technical Lead
M: +94 777 219 791
Tel : 94 11 214 5345
Fax :94 11 2145300
Skype : malaka.sampath.silva
LinkedIn : http://www.linkedin.com/pub/malaka-silva/6/33/77
Blog : http://mrmalakasilva.blogspot.com/

WSO2, Inc.
lean . enterprise . middleware
https://wso2.com/signature
http://www.wso2.com/about/team/malaka-silva/
<http://wso2.com/about/team/malaka-silva/>
https://store.wso2.com/store/

Don't make Trees rare, we should keep them with care
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to