I am trying to read csv data from a file and convert it into json data by using the CSV-Connector in WSO2 Integration studio. The data is converted to json when I pass it as payload, but how do I do it when I want to read csv data from a file by using the Connector? What extra connectors or mediators might be required for the same?
Asked
Active
Viewed 309 times
2 Answers
2
You can use WSO2 File connector https://docs.wso2.com/display/ESBCONNECTORS/Working+with+the+File+Connector
https://docs.wso2.com/display/ESBCONNECTORS/File+Connector
or you can write new custom mediator https://docs.wso2.com/display/EI660/Class+Mediator+ with your logic.

jakub.voves
- 107
- 7
-
I did try reading the csv data using file connector, but it give me this error: [TestConnection]Failed to initiate file connector configuration. org.wso2.carbon.connector.exception.InvalidConfigurationException: Parameter 'fileLockScheme' contains empty value. Any idea why I'm getting this when trying to read? – Ruby Jul 07 '22 at 18:12
-
1can you add xml from your service? – jakub.voves Jul 07 '22 at 18:27
2
First, you need to read the file using the File Connector or using the VFS transport. (Either use a VFS Listener proxy or a File Inbound Endpoint). There is a File Inbound sample on the getting started page in the Integration Studio
.
After reading the file youcan use the CSV-Connector
, Datamapper Mediator
or use the Smooks Mediator to convert the CSV into a XML and then to a JSON.

ycr
- 12,828
- 2
- 25
- 45
-
I've tried using the read operation of FileConnector but I get the following error: [TestConnection]Failed to initiate file connector configuration. org.wso2.carbon.connector.exception.InvalidConfigurationException: Parameter 'fileLockScheme' contains empty value. – Ruby Jul 08 '22 at 02:47
-
Did you enable `FileLock`? Try adding
Local to your connector configurations. – ycr Jul 08 '22 at 02:52 -
Yea, after adding this it works. But the data comes out as Base64. I added the enrich mediator. How do I get the data as it is – Ruby Jul 08 '22 at 03:42
-