0

I am trying FileMerge Operation in WSO2 EI 6.6.0 using FileConnector 2.0.24.

The problem here is that it is generating an output file with empty content.

API Code:

    <?xml version="1.0" encoding="UTF-8"?>
<api context="/mergefiles" name="FileMergeAPI" xmlns="http://ws.apache.org/ns/synapse">
    <resource methods="POST">
        <inSequence>
            <log level="custom">
                <property name="********FileMergeAPI" value="Called***********"/>
            </log>
            <property expression="json-eval($.source)" name="sourceDir" scope="default" type="STRING"/>
            <property expression="json-eval($.destination)" name="destDir" scope="default" type="STRING"/>
             <property expression="json-eval($.pattern)" name="pattern"/>
            <property expression="fn:concat('file:///', $ctx:sourceDir)" name="sourceDir1" scope="default" type="STRING"/>
            <property expression="fn:concat('file:///', $ctx:destDir)" name="destDir1" scope="default" type="STRING"/>
            <fileconnector.mergeFiles>
                <source>{$ctx:sourceDir1}</source>
                <destination>{$ctx:destDir1}</destination>
                <filePattern>{$ctx:pattern}</filePattern>
            </fileconnector.mergeFiles>
            <log level="full"/>
        </inSequence>
        <outSequence/>
        <faultSequence>
            <log level="custom">
                <property name="text" value="An unexpected error occured"/>
                <property expression="get-property('ERROR_MESSAGE')" name="message"/>
                <property expression="get-property('ERROR_DETAIL')" name="errordetail"/>
            </log>
            <send description="Send Error Information"/>
        </faultSequence>
    </resource>
</api>

Input:

{
"source":"C://Development_Avecto//filemerge//input",
"destination":"C://Development_Avecto//filemerge//output//sample.csv",
"pattern":"//*.csv*"

}

wireLog:

[2022-05-02 13:13:13,417] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 >> "POST /mergefiles HTTP/1.1[\r][\n]"
[2022-05-02 13:13:13,419] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 >> "Content-Type: application/json[\r][\n]"
[2022-05-02 13:13:13,422] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 >> "User-Agent: PostmanRuntime/7.29.0[\r][\n]"
[2022-05-02 13:13:13,423] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 >> "Accept: */*[\r][\n]"
[2022-05-02 13:13:13,425] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 >> "Cache-Control: no-cache[\r][\n]"
[2022-05-02 13:13:13,426] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 >> "Postman-Token: dd7b1a25-b87e-4d64-b474-36b13159042a[\r][\n]"
[2022-05-02 13:13:13,427] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 >> "Host: 192.168.43.128:8280[\r][\n]"
[2022-05-02 13:13:13,428] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 >> "Accept-Encoding: gzip, deflate, br[\r][\n]"
[2022-05-02 13:13:13,429] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 >> "Connection: keep-alive[\r][\n]"
[2022-05-02 13:13:13,433] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 >> "Content-Length: 164[\r][\n]"
[2022-05-02 13:13:13,436] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 >> "[\r][\n]"
[2022-05-02 13:13:13,438] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 >> "{[\r][\n]"
[2022-05-02 13:13:13,438] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 >> "    "source":"C://Development_Avecto//filemerge//input",[\r][\n]"
[2022-05-02 13:13:13,439] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 >> "    "destination":"C://Development_Avecto//filemerge//output//sample.csv",[\r][\n]"
[2022-05-02 13:13:13,440] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 >> "    "pattern":"//*.csv*"[\r][\n]"
[2022-05-02 13:13:13,441] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 >> "}"
[2022-05-02 13:13:13,444]  INFO {org.apache.synapse.mediators.builtin.LogMediator} - ********FileMergeAPI = Called***********
[2022-05-02 13:13:13,464]  INFO {org.apache.synapse.mediators.builtin.LogMediator} - To: /mergefiles, MessageID: urn:uuid:90d67ec1-2a3f-4f13-8389-049a24abbdab, Direction: request, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><success>true</success></soapenv:Body></soapenv:Envelope>
[2022-05-02 13:13:13,478] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 << "HTTP/1.1 202 Accepted[\r][\n]"
[2022-05-02 13:13:13,479] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 << "Date: Mon, 02 May 2022 07:43:13 GMT[\r][\n]"
[2022-05-02 13:13:13,480] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 << "Transfer-Encoding: chunked[\r][\n]"
[2022-05-02 13:13:13,481] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 << "Connection: keep-alive[\r][\n]"
[2022-05-02 13:13:13,481] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 << "[\r][\n]"
[2022-05-02 13:13:13,483] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 << "0[\r][\n]"
[2022-05-02 13:13:13,483] DEBUG {org.apache.synapse.transport.http.wire} - HTTP-Listener I/O dispatcher-3 << "[\r][\n]"

if you noticed above wire log i got success response post mergefile operation like below

<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><success>true</success></soapenv:Body></soapenv:Envelope>

I already looked this question which doesn't resolve my issue

File 1 content :

file1

File 2 content: file 2

PS: WSO2 EI 6.5.0 also tried the same. getting empty file

What is wrong with the above configuration?

Community
  • 1
  • 1
Justin
  • 855
  • 2
  • 11
  • 30
  • Do you get any errors while invoking the API – Shanaka Dilan Premarathna Mar 26 '22 at 15:36
  • Hi @ShanakaPremarathna, Thanks for your reply. No error in logs. just file log gets printed which is added in the above code as the first line. nothing apart from that. – Justin Mar 26 '22 at 16:08
  • Hi @ShanakaPremarathna Do you have any suggestions on above? similar questions which added in my question also stating the same problem, Kindly help on this. – Justin Mar 30 '22 at 07:15
  • Hi @ShanakaPremarathna I have updated my questions with elaborate details like logs, input content etc. kindly look into this? – Justin May 02 '22 at 07:55
  • Hi Team, Merge Operation is working for text files only (.txt), not for csv file (.csv) by using WSO2 EI 6.5.0 with file connector 2.0.24 . – Justin May 09 '22 at 10:11
  • can you report an issue here https://github.com/wso2/product-ei/issues – Shanaka Dilan Premarathna May 11 '22 at 05:58
  • Hi @ShanakaPremarathna Thanks for your response. raised issue in github https://github.com/wso2/product-ei/issues/5562 – Justin May 11 '22 at 11:55

0 Answers0