Hi Kathees,

 I have tried as you mentioned, it is working.

 private void findAndWrite2OutputStream(MessageContext messageContext,
                                           OutputStream out,
                                           boolean preserve) throws
AxisFault {
        try {
          SOAPEnvelope envelope = messageContext.getEnvelope();
          OMElement contentEle = envelope.getBody().getFirstElement();
            if (contentEle != null) {
                OMNode node = contentEle.getFirstOMChild();
                if (!(node instanceof OMText)) {
                    String msg = "Wrong Input for the Validator, " +
                            "the content of the first child element of the
Body " +
                            "should have the zip file";
                    log.error(msg);
                    throw new AxisFault(msg);
                }
                OMText binaryDataNode = (OMText) node;
                DataHandler dh = (DataHandler)
binaryDataNode.getDataHandler();

                DataSource dataSource = dh.getDataSource();
                if(dataSource instanceof StreamingOnRequestDataSource) {
                    if (((StreamingOnRequestDataSource)
dataSource).isConsumed()) {
                        Object httpMethodObj =
messageContext.getProperty(Constants.Configuration.HTTP_METHOD);
                        if ((httpMethodObj instanceof String) &&
"POST".equals(httpMethodObj)) {
                            log.warn("Attempting to send an already
consumed request [" +
                                     messageContext.getTo().getAddress() +
" POST/Empty Message Body]");
                        }
                    }

                    //Ask the data source to stream, if it has not already
cached the request
                    if (!preserve && dataSource instanceof
StreamingOnRequestDataSource) {
                        ((StreamingOnRequestDataSource)
dataSource).setLastUse(true);
                    }
                }
                dh.writeTo(out);
            }
        } catch (OMException e) {
            log.error(e);
            throw AxisFault.makeFault(e);
        } catch (IOException e) {
            log.error(e);
            throw AxisFault.makeFault(e);
        }
    }

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

On Fri, Nov 25, 2016 at 10:52 AM, Kathees Rajendram <[email protected]>
wrote:

> If the datasource from your operation is not instance of
> StreamingOnRequestDataSource and you can directly write. In this case, you
> don't need to cast.
>
> On Fri, Nov 25, 2016 at 10:20 AM, Vivekananthan Sivanayagam <
> [email protected]> wrote:
>
>> Hi Malaka,
>>
>> I am getting the casting exception in the following methods in the
>> carbon-mediation[1].
>>
>> private void findAndWrite2OutputStream(MessageContext messageContext,
>>                                            OutputStream out,
>>                                            boolean preserve) throws
>> AxisFault {
>>         try {
>>             SOAPEnvelope envelope = messageContext.getEnvelope();
>>           OMElement contentEle = envelope.getBody().getFirstElement();
>>             if (contentEle != null) {
>>                 OMNode node = contentEle.getFirstOMChild();
>>                 if (!(node instanceof OMText)) {
>>                     String msg = "Wrong Input for the Validator, " +
>>                             "the content of the first child element of
>> the Body " +
>>                             "should have the zip file";
>>                     log.error(msg);
>>                     throw new AxisFault(msg);
>>                 }
>>                 OMText binaryDataNode = (OMText) node;
>>                 DataHandler dh = (DataHandler)
>> binaryDataNode.getDataHandler();
>>
>>                 DataSource dataSource = dh.getDataSource();
>>                     if (((StreamingOnRequestDataSource)
>> dataSource).isConsumed()) {
>>                         Object httpMethodObj =
>> messageContext.getProperty(Constants.Configuration.HTTP_METHOD);
>>                         if ((httpMethodObj instanceof String) &&
>> "POST".equals(httpMethodObj)) {
>>                             log.warn("Attempting to send an already
>> consumed request [" +
>>                                      messageContext.getTo().getAddress()
>> + " POST/Empty Message Body]");
>>                         }
>>                     }
>>
>>                     //Ask the data source to stream, if it has not
>> already cached the request
>>                     if (!preserve && dataSource instanceof
>> StreamingOnRequestDataSource) {
>>                         ((StreamingOnRequestDataSource)
>> dataSource).setLastUse(true);
>>                     }
>>
>>                 dh.writeTo(out);
>>             }
>>         } catch (OMException e) {
>>             log.error(e);
>>             throw AxisFault.makeFault(e);
>>         } catch (IOException e) {
>>             log.error(e);
>>             throw AxisFault.makeFault(e);
>>         }
>>     }
>>
>>
>> [1] https://github.com/wso2/carbon-mediation/blob/master/com
>> ponents/mediation-monitor/message-relay/org.wso2.carbon.rela
>> y/src/main/java/org/wso2/carbon/relay/ExpandingMessageFormatter.java#L185
>>
>> Vivekananthan Sivanayagam
>> Associate Software Engineer | WSO2
>> E:[email protected]
>> M:+94752786138
>>
>> On Thu, Nov 24, 2016 at 4:30 PM, Malaka Silva <[email protected]> wrote:
>>
>>>
>>>
>>> On Thu, Nov 24, 2016 at 4:25 PM, Vivekananthan Sivanayagam <
>>> [email protected]> wrote:
>>>
>>>> Hi Malaka,
>>>>
>>>> When I enable builders as I mentioned in the previous mail, It is
>>>> working always for the false statement[1] of streaming even enabling the
>>>> streaming. We have to use "<messageBuilder contentType="application/file"
>>>> class="org.apache.axis2.format.BinaryBuilder"/>", If I use this one, I
>>>> am getting
>>>> "PassThroughHttpSender Failed to submit the response" error.
>>>>
>>> ​We have to dig into this and find the root cause.​
>>>
>>>
>>>>
>>>> We were able to write the file content into the message context but
>>>> could not get this as a response, and I checked the test case and found the
>>>> reason why it worked, there streaming is set as true and content type is
>>>> as "text/plain", in this case also consider as an else statement, that is
>>>> why test cases are passed.
>>>>
>>> ​Currently latest connector read does not work. So ideally the test case
>>> should fail.​
>>>
>>>
>>>>
>>>> [1]
>>>>
>>>> ​
>>>> ​
>>>> InputStream in;
>>>>
>>>> if (builder instanceof DataSourceMessageBuilder && 
>>>> "true".equals(streaming)) {
>>>>     in = null;
>>>>     dataSource = ManagedDataSourceFactory.create(new 
>>>> FileObjectDataSource(file, contentType));
>>>> } else {
>>>>     in = new AutoCloseInputStream(file.getContent().getInputStream());
>>>>     dataSource = null;
>>>> }
>>>>
>>>>
>>>> Vivekananthan Sivanayagam
>>>> Associate Software Engineer | WSO2
>>>> E:[email protected]
>>>> M:+94752786138
>>>>
>>>> On Thu, Nov 24, 2016 at 10:23 AM, Vivekananthan Sivanayagam <
>>>> [email protected]> wrote:
>>>>
>>>>> Hi Malaka,
>>>>>
>>>>> When I use "<messageBuilder contentType="application/file"
>>>>> class="org.wso2.carbon.relay.BinaryRelayBuilder"/>" instead of
>>>>> "<messageBuilder contentType="application/file"
>>>>> class="org.apache.axis2.format.BinaryBuilder"/>", it is working fine.
>>>>>
>>>>> Vivekananthan Sivanayagam
>>>>> Associate Software Engineer | WSO2
>>>>> E:[email protected]
>>>>> M:+94752786138
>>>>>
>>>>> On Wed, Nov 23, 2016 at 3:26 PM, Vivekananthan Sivanayagam <
>>>>> [email protected]> wrote:
>>>>>
>>>>>> Hi Makala,
>>>>>>
>>>>>> I tried the given config and getting the following error.
>>>>>>
>>>>>> [2016-11-23 15:00:47,188] DEBUG - wire HTTP-Listener I/O dispatcher-6
>>>>>> >> "POST /services/fileconnectorRead HTTP/1.1[\r][\n]"
>>>>>> [2016-11-23 15:00:47,189] DEBUG - wire HTTP-Listener I/O dispatcher-6
>>>>>> >> "Host: vive.example.com:8280[\r][\n]"
>>>>>> [2016-11-23 15:00:47,189] DEBUG - wire HTTP-Listener I/O dispatcher-6
>>>>>> >> "Connection: keep-alive[\r][\n]"
>>>>>> [2016-11-23 15:00:47,189] DEBUG - wire HTTP-Listener I/O dispatcher-6
>>>>>> >> "Content-Length: 115[\r][\n]"
>>>>>> [2016-11-23 15:00:47,189] DEBUG - wire HTTP-Listener I/O dispatcher-6
>>>>>> >> "Postman-Token: 1cdab400-d939-ad00-29ca-2d65a4db15fb[\r][\n]"
>>>>>> [2016-11-23 15:00:47,189] DEBUG - wire HTTP-Listener I/O dispatcher-6
>>>>>> >> "Cache-Control: no-cache[\r][\n]"
>>>>>> [2016-11-23 15:00:47,189] DEBUG - wire HTTP-Listener I/O dispatcher-6
>>>>>> >> "Origin: chrome-extension://fhbjgbiflin
>>>>>> jbdggehcddcbncdddomop[\r][\n]"
>>>>>> [2016-11-23 15:00:47,190] DEBUG - wire HTTP-Listener I/O dispatcher-6
>>>>>> >> "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 
>>>>>> >> (KHTML,
>>>>>> like Gecko) Chrome/54.0.2840.100 Safari/537.36[\r][\n]"
>>>>>> [2016-11-23 15:00:47,190] DEBUG - wire HTTP-Listener I/O dispatcher-6
>>>>>> >> "Content-Type: application/json[\r][\n]"
>>>>>> [2016-11-23 15:00:47,190] DEBUG - wire HTTP-Listener I/O dispatcher-6
>>>>>> >> "Accept: */*[\r][\n]"
>>>>>> [2016-11-23 15:00:47,190] DEBUG - wire HTTP-Listener I/O dispatcher-6
>>>>>> >> "Accept-Encoding: gzip, deflate[\r][\n]"
>>>>>> [2016-11-23 15:00:47,190] DEBUG - wire HTTP-Listener I/O dispatcher-6
>>>>>> >> "Accept-Language: en-US,en;q=0.8[\r][\n]"
>>>>>> [2016-11-23 15:00:47,190] DEBUG - wire HTTP-Listener I/O dispatcher-6
>>>>>> >> "Cookie: exchangecookie=3220c865f3bc4a0981edd476a839a747[\r][\n]"
>>>>>> [2016-11-23 15:00:47,190] DEBUG - wire HTTP-Listener I/O dispatcher-6
>>>>>> >> "[\r][\n]"
>>>>>> [2016-11-23 15:00:47,190] DEBUG - wire HTTP-Listener I/O dispatcher-6
>>>>>> >> "{[\n]"
>>>>>> [2016-11-23 15:00:47,190] DEBUG - wire HTTP-Listener I/O dispatcher-6
>>>>>> >> "     "source":"/home/vive/Desktop/FILE/abc.txt",[\n]"
>>>>>> [2016-11-23 15:00:47,190] DEBUG - wire HTTP-Listener I/O dispatcher-6
>>>>>> >> "     "contentType":"application/file",[\n]"
>>>>>> [2016-11-23 15:00:47,190] DEBUG - wire HTTP-Listener I/O dispatcher-6
>>>>>> >> "     "streaming":"true"[\n]"
>>>>>> [2016-11-23 15:00:47,190] DEBUG - wire HTTP-Listener I/O dispatcher-6
>>>>>> >> "}"
>>>>>> [2016-11-23 15:00:47,195] ERROR - SynapseJsonPath #stringValueOf.
>>>>>> Error evaluating JSON Path <$.address>. Returning empty result. Error>>>
>>>>>> invalid path
>>>>>> [2016-11-23 15:00:47,199] ERROR - SynapseJsonPath #stringValueOf.
>>>>>> Error evaluating JSON Path <$.append>. Returning empty result. Error>>>
>>>>>> invalid path
>>>>>> [2016-11-23 15:00:47,206] ERROR - SynapseJsonPath #stringValueOf.
>>>>>> Error evaluating JSON Path <$.address>. Returning empty result. Error>>>
>>>>>> invalid path
>>>>>> [2016-11-23 15:00:47,207] ERROR - SynapseJsonPath #stringValueOf.
>>>>>> Error evaluating JSON Path <$.append>. Returning empty result. Error>>>
>>>>>> invalid path
>>>>>> [2016-11-23 15:00:47,208] ERROR - SynapseJsonPath #stringValueOf.
>>>>>> Error evaluating JSON Path <$.source>. Returning empty result. Error>>>
>>>>>> invalid path
>>>>>> [2016-11-23 15:00:47,208] ERROR - SynapseJsonPath #stringValueOf.
>>>>>> Error evaluating JSON Path <$.contentType>. Returning empty result.
>>>>>> Error>>> invalid path
>>>>>> [2016-11-23 15:00:47,209] ERROR - SynapseJsonPath #stringValueOf.
>>>>>> Error evaluating JSON Path <$.streaming>. Returning empty result. 
>>>>>> Error>>>
>>>>>> invalid path
>>>>>> [2016-11-23 15:00:47,214] ERROR - FileRead Could not find file with
>>>>>> URI "" because it is a relative path, and no base URI was provided.
>>>>>> [2016-11-23 15:00:47,228]  INFO - LogMediator To:
>>>>>> /services/001fileconnectorRead, MessageID:
>>>>>> urn:uuid:f863b8d3-3a50-495c-bae1-2198715a0926, Direction: request,
>>>>>> MESSAGE = Executing default 'fault' sequence, ERROR_CODE = 0, 
>>>>>> ERROR_MESSAGE
>>>>>> = Error occured in the mediation of the class mediator, Envelope: <?xml
>>>>>> version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="
>>>>>> http://schemas.xmlsoap.org/soap/envelope/";><soapenv:Body><axis2ns6:binary
>>>>>> xmlns:axis2ns6="http://ws.apache.org/commons/ns/payload";>SSB
>>>>>> jaGVja2VkIHRoZSBmb2xsb3dpbmcgc2NlbmFyaW9bMV0gd2l0aCBzdHJlYW1
>>>>>> pbmcgZW5hYmxlLCBJIGFtIGFibGUgc3VjY2VzcyB3aXRoIHRoZSByZXNwb25
>>>>>> zZSBmaWxlLiBJIHRyaWVkIDRHQiBmaWxlIHRvIHNlbmQgLCBpdCBpcyB3b3J
>>>>>> raW5nLiBXaGVuIEkgY2hlY2tlZCBvbmx5IEZpbGVSZWFkIG9wZXJhdGlvbiB
>>>>>> 3aXRoIHN0cmVhbWluZywgSSB3YXMgYWJsZSB0byByZWFkIHRoZSBjb250ZW5
>>>>>> 0IGluIHRoZSBtZXNzYWdlIGNvbnRleHQgYnV0IGNvdWxkIG5vdCBidWlsZCB
>>>>>> pdCB0aGUgdXNpbmcgRGF0YVNvdXJjZU1lc3NhZ2VCdWlsZGVyIHdpdGggY29
>>>>>> udGVudCB0eXBlICJhcHBsaWNhdGlvbi9maWxlIiBhbmQgc2hvd2luZyB0aGU
>>>>>> gZm9sbG93aW5nIGVycm9yLiAK</axis2ns6:binary></soapenv:Body></
>>>>>> soapenv:Envelope>
>>>>>> [2016-11-23 15:00:47,228] ERROR - PassThroughHttpSender Failed to
>>>>>> submit the response
>>>>>> java.lang.ClassCastException: com.sun.proxy.$Proxy21 cannot be cast
>>>>>> to org.wso2.carbon.relay.StreamingOnRequestDataSource
>>>>>> at org.wso2.carbon.relay.ExpandingMessageFormatter.findAndWrite
>>>>>> 2OutputStream(ExpandingMessageFormatter.java:185)
>>>>>> at org.wso2.carbon.relay.ExpandingMessageFormatter.writeTo(Expa
>>>>>> ndingMessageFormatter.java:100)
>>>>>> at org.apache.synapse.transport.passthru.PassThroughHttpSender.
>>>>>> submitResponse(PassThroughHttpSender.java:555)
>>>>>> at org.apache.synapse.transport.passthru.PassThroughHttpSender.
>>>>>> invoke(PassThroughHttpSender.java:264)
>>>>>> at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
>>>>>> at org.apache.synapse.core.axis2.Axis2Sender.sendBack(Axis2Send
>>>>>> er.java:222)
>>>>>> at org.apache.synapse.mediators.builtin.RespondMediator.mediate
>>>>>> (RespondMediator.java:35)
>>>>>> at org.apache.synapse.mediators.AbstractListMediator.mediate(Ab
>>>>>> stractListMediator.java:97)
>>>>>> at org.apache.synapse.mediators.AbstractListMediator.mediate(Ab
>>>>>> stractListMediator.java:59)
>>>>>> at org.apache.synapse.mediators.base.SequenceMediator.mediate(S
>>>>>> equenceMediator.java:158)
>>>>>> at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.re
>>>>>> ceive(ProxyServiceMessageReceiver.java:210)
>>>>>> at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
>>>>>> at org.apache.synapse.transport.passthru.ServerWorker.processNo
>>>>>> nEntityEnclosingRESTHandler(ServerWorker.java:325)
>>>>>> at org.apache.synapse.transport.passthru.ServerWorker.processEn
>>>>>> tityEnclosingRequest(ServerWorker.java:371)
>>>>>> at org.apache.synapse.transport.passthru.ServerWorker.run(Serve
>>>>>> rWorker.java:151)
>>>>>> at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.r
>>>>>> un(NativeWorkerPool.java:172)
>>>>>> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPool
>>>>>> Executor.java:1145)
>>>>>> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo
>>>>>> lExecutor.java:615)
>>>>>> at java.lang.Thread.run(Thread.java:745)
>>>>>> [2016-11-23 15:00:47,230] ERROR - Axis2Sender
>>>>>> Accept:*/*,Accept-Encoding:gzip, deflate,Accept-Language:en-US,
>>>>>> en;q=0.8,Cache-Control:no-cache,Content-Type:application/jso
>>>>>> n,Cookie:exchangecookie=3220c865f3bc4a0981edd476a839a747,Host:
>>>>>> vive.example.com:8280,Origin:chrome-extension://fhbjgbifli
>>>>>> njbdggehcddcbncdddomop,Postman-Token:1cdab400-d939-ad00-29ca-2d65a4db15fb,<?xml
>>>>>> version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="
>>>>>> http://schemas.xmlsoap.org/soap/envelope/";><soapenv:Body><axis2ns6:binary
>>>>>> xmlns:axis2ns6="http://ws.apache.org/commons/ns/payload";>SSB
>>>>>> jaGVja2VkIHRoZSBmb2xsb3dpbmcgc2NlbmFyaW9bMV0gd2l0aCBzdHJlYW1
>>>>>> pbmcgZW5hYmxlLCBJIGFtIGFibGUgc3VjY2VzcyB3aXRoIHRoZSByZXNwb25
>>>>>> zZSBmaWxlLiBJIHRyaWVkIDRHQiBmaWxlIHRvIHNlbmQgLCBpdCBpcyB3b3J
>>>>>> raW5nLiBXaGVuIEkgY2hlY2tlZCBvbmx5IEZpbGVSZWFkIG9wZXJhdGlvbiB
>>>>>> 3aXRoIHN0cmVhbWluZywgSSB3YXMgYWJsZSB0byByZWFkIHRoZSBjb250ZW5
>>>>>> 0IGluIHRoZSBtZXNzYWdlIGNvbnRleHQgYnV0IGNvdWxkIG5vdCBidWlsZCB
>>>>>> pdCB0aGUgdXNpbmcgRGF0YVNvdXJjZU1lc3NhZ2VCdWlsZGVyIHdpdGggY29
>>>>>> udGVudCB0eXBlICJhcHBsaWNhdGlvbi9maWxlIiBhbmQgc2hvd2luZyB0aGU
>>>>>> gZm9sbG93aW5nIGVycm9yLiAK</axis2ns6:binary></soapenv:Body></soapenv:Envelope>
>>>>>> Unexpected error sending message back
>>>>>> org.apache.axis2.AxisFault: Failed to submit the response
>>>>>> at org.apache.synapse.transport.passthru.PassThroughHttpSender.
>>>>>> handleException(PassThroughHttpSender.java:613)
>>>>>> at org.apache.synapse.transport.passthru.PassThroughHttpSender.
>>>>>> invoke(PassThroughHttpSender.java:266)
>>>>>> at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
>>>>>> at org.apache.synapse.core.axis2.Axis2Sender.sendBack(Axis2Send
>>>>>> er.java:222)
>>>>>> at org.apache.synapse.mediators.builtin.RespondMediator.mediate
>>>>>> (RespondMediator.java:35)
>>>>>> at org.apache.synapse.mediators.AbstractListMediator.mediate(Ab
>>>>>> stractListMediator.java:97)
>>>>>> at org.apache.synapse.mediators.AbstractListMediator.mediate(Ab
>>>>>> stractListMediator.java:59)
>>>>>> at org.apache.synapse.mediators.base.SequenceMediator.mediate(S
>>>>>> equenceMediator.java:158)
>>>>>> at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.re
>>>>>> ceive(ProxyServiceMessageReceiver.java:210)
>>>>>> at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
>>>>>> at org.apache.synapse.transport.passthru.ServerWorker.processNo
>>>>>> nEntityEnclosingRESTHandler(ServerWorker.java:325)
>>>>>> at org.apache.synapse.transport.passthru.ServerWorker.processEn
>>>>>> tityEnclosingRequest(ServerWorker.java:371)
>>>>>> at org.apache.synapse.transport.passthru.ServerWorker.run(Serve
>>>>>> rWorker.java:151)
>>>>>> at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.r
>>>>>> un(NativeWorkerPool.java:172)
>>>>>> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPool
>>>>>> Executor.java:1145)
>>>>>> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo
>>>>>> lExecutor.java:615)
>>>>>> at java.lang.Thread.run(Thread.java:745)
>>>>>> Caused by: java.lang.ClassCastException: com.sun.proxy.$Proxy21
>>>>>> cannot be cast to org.wso2.carbon.relay.StreamingOnRequestDataSource
>>>>>> at org.wso2.carbon.relay.ExpandingMessageFormatter.findAndWrite
>>>>>> 2OutputStream(ExpandingMessageFormatter.java:185)
>>>>>> at org.wso2.carbon.relay.ExpandingMessageFormatter.writeTo(Expa
>>>>>> ndingMessageFormatter.java:100)
>>>>>> at org.apache.synapse.transport.passthru.PassThroughHttpSender.
>>>>>> submitResponse(PassThroughHttpSender.java:555)
>>>>>> at org.apache.synapse.transport.passthru.PassThroughHttpSender.
>>>>>> invoke(PassThroughHttpSender.java:264)
>>>>>> ... 15 more
>>>>>>
>>>>>>
>>>>>> Vivekananthan Sivanayagam
>>>>>> Associate Software Engineer | WSO2
>>>>>> E:[email protected]
>>>>>> M:+94752786138
>>>>>>
>>>>>> On Wed, Nov 23, 2016 at 7:49 AM, Malaka Silva <[email protected]>
>>>>>> wrote:
>>>>>>
>>>>>>> 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
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>>
>>> --
>>>
>>> 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
>>
>>
>
>
> --
> Kathees
> Software Engineer,
> email: [email protected]
> mobile: +94772596173
>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to