Showing posts from February, 2020

CSV to SOAP Message conversion with Smooks Mediator

Smook Mediator available in WSO2 EI/ESB can be used to do various message transformations. For an example read CSV file and transform to XML . I had a requirement where I wanted to load a CSV file content into the database. So, my initial idea was to convert CSV content into XML, then use the XSLT mediator to generate a data service request. But it will be a costly operation with lots of resource consumption. Therefore, instead of generating a data service request via XSLT, I tried to use the options available in Smooks. Smooks provides FreeMaker based templating support that can be used to convert CSV to SOAP. Here, first I have created a sample input CSV file and expected Data Service sample request message. With this, it will be very easy to generate data mapping. Below are the examples of CSV and Data Service models Sample.csv: UserId,NameFirst,NameLast 1,Chandana,Napagoda 2,John,Tester SampleOut.xml :  <au:addUsers_batch_req xmlns:au="https://blo