0
votes

I tried to create a Data-Mapper example in mule in which both inbound and outbound endpoints are File, Looks some thing like.

enter image description here

When i execute this program output folder of file remains empty, Logically i assume that i need to put and HashMap to XML transformer between Data Mapper and Output File. More Over i created a csv file to xml file selecting from example option in data mapper. Initially i tried to use FTP endpoint it started resulting into error so i replaced FTP with file endpoint.

Here I am Sharing configuration.xml file

<mule xmlns:file="....>
    <data-mapper:config name="sample_mapper_grf" transformationGraphPath="sample_mapper.grf" doc:name="DataMapper"/>
    <flow name="CSV_to_XML_Data_MapperFlow1" doc:name="CSV_to_XML_Data_MapperFlow1">
        <file:inbound-endpoint path="/home/jay/CSV_XML_/input"  responseTimeout="10000" doc:name="Input File"/>
        <data-mapper:transform config-ref="sample_mapper_grf" doc:name="DataMapper"/>
        <file:outbound-endpoint path="/home/jay/CSV_XML_/output/" responseTimeout="10000" doc:name="Output File"/>
    </flow>
</mule>

Data-Mapper configuration image is here This image is specification of Csv File to xml and when i move on preview on Right top and Run it successfully converts csv to xml

2
Can you share your mule xml configuration? - genjosanzo
I have edited my post with few more details. - Jay Trivedi
What happens when you drop a CSV file in /home/jay/CSV_XML_/input? Anything in the logs? Is the file auto-deleted by Mule? - David Dossot
Your Data-Mapper is showing an error. Did you resolve that? Also if you change the structure of the underlying file and tell it to refresh the metadata, it can leave artifacts. You may want to go into the script view and see if there are things hanging around in there that shouldn't be. - SteveS
No Steve actually i am not able to frame the error but i will upload the entire project and paste the link here. More even after errors it successfully gets converted in xml. - Jay Trivedi

2 Answers

0
votes

Add a Groovy component after the data mapper and try and dump the contents

println "post mapping payload " + payload 
return payload 
0
votes

I got it resolved using.

enter image description here

here is the configuration.xml

<mule ....>
    <data-mapper:config     name="sample_mapper_grf"transformationGraphPath="sample_mapper.grf" doc:name="DataMapper"/>
    <flow name="CSV_to_XML_Data_MapperFlow1" doc:name="CSV_to_XML_Data_MapperFlow1">
        <file:inbound-endpoint path="/home/jay/CSV_XML_/input"  responseTimeout="10000"     doc:name="Input File"/>
        <data-mapper:transform config-ref="sample_mapper_grf" doc:name="DataMapper"/>
        <object-to-string-transformer doc:name="Object to String"/>
        <file:outbound-endpoint path="/home/jay/Output" responseTimeout="10000"     doc:name="File" outputPattern="#[function:dateStamp].xml"/>
    </flow>
</mule>