Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FileConnector][read]CSV file cannot be read #1462

Closed
isuruuy429 opened this issue Apr 23, 2020 · 1 comment
Closed

[FileConnector][read]CSV file cannot be read #1462

isuruuy429 opened this issue Apr 23, 2020 · 1 comment
Assignees

Comments

@isuruuy429
Copy link
Contributor

Steps to reproduce:

  1. Create the following API in the Integration Studio.
<?xml version="1.0" encoding="UTF-8"?>
<api context="/file" name="File" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="POST" uri-template="/read">
        <inSequence>
            <property expression="json-eval($.source)" name="source" scope="default" type="STRING"/>
            <property expression="json-eval($.contentType)" name="contentType" scope="default" type="STRING"/>
            <fileconnector.read>
                <source>{$ctx:source}</source>
                <contentType>{$ctx:contentType}</contentType>
            </fileconnector.read>
            <respond/>
        </inSequence>
        <outSequence/>
        <faultSequence/>
    </resource>
</api>
  1. Create the following csv file in a specific folder, and save it as employee.csv.
empId,firstName,lastName,joinedDate
100,Lois,Walker,11/24/2003
101,Brenda,Robinson,7/27/2008
102,Joe,Robinson,8/3/2016
103,Diane,Evans,4/16/1999
104,Benjamin,Russell,7/25/2013
  1. Invoke the API with the following payload.
{
	"source":"/Users/IsuruUyanage/Desktop/employee.csv",
	"contentType":"text/csv"
}

Expected: It should read the csv file.
Actual: It provides the following output.

{"binary":"ZW1wSWQsZmlyc3ROYW1lLGxhc3ROYW1lLGpvaW5lZERhdGUKMTAwLExvaXMsV2Fsa2VyLDExLzI0LzIwMDMKMTAxLEJyZW5kYSxSb2JpbnNvbiw3LzI3LzIwMDgKMTAyLEpvZSxSb2JpbnNvbiw4LzMvMjAxNgoxMDMsRGlhbmUsRXZhbnMsNC8xNi8xOTk5CjEwNCxCZW5qYW1pbixSdXNzZWxsLDcvMjUvMjAxMw=="}
@heysulo
Copy link
Contributor

heysulo commented May 9, 2022

Hi @isuruuy429,
There is no default builder or formatter for messages with the text/csv content type. That's why the default binary builder is being used. But you can get your expected behaviour with an axis2 configuration change. You can find more details on that in the Working with Message Builders and Formatters documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants