Skip to Content

Unzip the file from FTP and need to send same file name with .xml Extension

Hi ,

I am having one requirement : in FTP server I am having 3 directories with 3 file names :

Directory1 : PO_Server01_001*.zip (File Name to be pick)

Directory2: PO_server02_002*.zip (File Name to be pick)

Directory3: PO_server03_003*.zip (File Name to be pick)

I need to select the files from these directories and unzip the files , for this I used option Advanced selection for source file to pick the files from different directories , to unzip the files I used Module configuration (Payloadzip )it's working fine,

Here my issue I need to send same file name to the target system for this I used ASMA option in both Channels (Sender and Receiver) .

In target system I am seeing file names as : , , , Here I don't want file extension as .ZIP . The file name should be .xml (like PO_Server01_001111.xml)

Note: Files in FTP server are dynamic .

Thanks in advance.



Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Aug 29, 2016 at 10:22 AM

    Hi Shiva,

    Either you need adapter module or java mapping to resolve the issue.

    If you plan to use adapter module please check this blog

    If you want to create java mapping please use following approach

    package com.javaMapping;  
    import java.text.SimpleDateFormat;  
    import java.util.Date;  
    public class DynamicFileName_JavaMapping extends AbstractTransformation {  
         private static final DynamicConfigurationKey KEY_FILENAME =  
        public void transform(TransformationInput in, TransformationOutput out)  
                throws StreamTransformationException {  
            // TODO Auto-generated method stub  
            String newFileName = null;  
            Date date = new Date(); // get the current date  
            SimpleDateFormat dateFormatter = new SimpleDateFormat ("yyyyMMdd-HHmmss-SSS"); // set the format for date  
            String dfmt =  dateFormatter.format(date);  
              DynamicConfiguration conf = in.getDynamicConfiguration();  
              String oldFileName = conf.get(KEY_FILENAME);               
              oldFileName = oldFileName.replaceAll(".zip", ".xml");  
              newFileName = oldFileName ; // the final filename  
              String inData = convertStreamToString(in.getInputPayload().getInputStream());  
              String outData = inData;  
              try {  
            } catch (UnsupportedEncodingException e) {  
                // TODO Auto-generated catch block  
            } catch (IOException e) {  
                // TODO Auto-generated catch block  
          public String convertStreamToString(InputStream in){  
                StringBuffer sb = new StringBuffer();  
                InputStreamReader isr = new InputStreamReader(in);  
                Reader reader =  
                new BufferedReader(isr);  
                int ch;  
                while((ch = > -1) {  
                catch(Exception exception) { }  
                return sb.toString();  

    ESR steps


    1) Create a Data Type





    2) Create a Message Type, MT_Structure and refer DT_Structure.

    3) Create an Outbound Service Interface, SI_Structure_Out and refer MT_Structure.

    4) Create an Inbound Service Interface, SI_Structure_In and refer MT_Structure.

    5) Create an Operational Mapping, OM_Structure. Refer SI_Structure_Out and SI_Structure_In.

    6) Create a zip or jar file of below Java Mapping ‘DynamicFileName_JavaMapping’ (compiled). Import it into ESR as imported archive. Refer this Java Mapping in OM_Structure.

    ID steps


    1) Create a File Sender channel. In ‘Advance’ tab, select ‘Use Adapter-Specific Message Attributes’ and ‘File Name’.

    2) In Receiver channel. In ‘Advance’ tab, select ‘Use Adapter-Specific Message Attributes’ and ‘File Name’.

    3) Create Sender and Receiver Communication Components. Create ‘Integrated Configuration’ Object to run scenario in Advance Adapter Engine

    4) When input is non-XML, and you are using ICO. Delete SWCV from ICO object.



    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.