cancel
Showing results for 
Search instead for 
Did you mean: 

Picking Zip file

Former Member
0 Kudos

Hi,

I have a file to proxy scenario where I need to pick some zip file (filename.dcu.gz format) from an FTP server using file adapter.

I dont want to use OS command for this .

I have used PayloadZipBean like that in the module parameter , but its not working -

In the file name of CC I have written " *.dcu.gz ".

Anyone Please help me what more I need to do to resolve the issue .

Thanks in advance .

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Apu,

Could please brief on problem that you are facing .

Does the zip file contains single file or multiple files?

Does the file contains csv or xml data?

Regards

Venkat

Former Member
0 Kudos

Hi Venkat,

Thanks you for your response.

This zip file contains single file with .dcu extension.

iaki_vila
Active Contributor
0 Kudos

Hi Apu,

Could you unzip the retrieved file manually?, it's to check if the file comes corrupted or not.

Regards.

Former Member
0 Kudos

Hi Vila,

Thank you for your reply.

Yes I can unzip it manually properly and after unzip its giving me abc.dcu file.

Former Member
0 Kudos

Hi Apu

Please create a simple java mapping to read the zip file and populate your desired output.

Sample java code:

import java.io.*;

import java.util.zip.ZipInputStream;

import java.util.zip.ZipEntry;

public class UnzipDemo {

  public static void main(String[] args) {

  String zipname = "data.zip";

  try {

    FileInputStream fis = new FileInputStream(zipname);

    ZipInputStream zis = new ZipInputStream(newBufferedInputStream(fis));

    ZipEntry entry;

  while ((entry = zis.getNextEntry()) != null) {

  System.out.println("Unzipping: " + entry.getName());

  int size;

  byte[] buffer = new byte[2048];

  FileOutputStream fos = newFileOutputStream(entry.getName());

  BufferedOutputStream bos = newBufferedOutputStream(fos, buffer.length);

  while((size = zis.read(buffer, 0, buffer.length)) != -1) {

  bos.write(buffer, 0, size);

  }

  bos.flush();

  bos.close();

  }

  zis.close();

  fis.close();

  } catch (IOException e) {

  e.printStackTrace();

  }

}

}

Former Member
0 Kudos

Hi,

Any sample OS command to extract the .gz file and how to use it in the CC as I am not getting any help using PayloadZipBean .

iaki_vila
Active Contributor
0 Kudos

Hi Apu,

A silly thing, try to use zip.Mode instead zip.mode.

Regards.

Former Member
0 Kudos

Hi Vila,

No help using zip.Mode ; its showing that zipping is successful but I am getting some gibberish vales after FCC .

Former Member
0 Kudos

Hi,

As I am not getting any help using PayloadZipBean, I have decided to write an command line argument in the before processing section.

Initially I am picking the file using NFS. File is in the following folder -

/sapmnt/NDX/global/TEST/abc.dcu.gz

I have written a simple shell script  gunzip *.gz and saved it as Unzip.sh and put it in the following path -

/sapmnt/NDX/global/TEST/Unzip.sh

I have written in the before processing of CC as /sapmnt/NDX/global/TEST/sh UnzipGz.sh


Though it was working in PUTTY while testing but its not working here .

Any help ....

iaki_vila
Active Contributor
0 Kudos

Hi Apu,

Try with gunzip parameter. Check PRAVEEN GUJJETI's blog 

Regards.

Former Member
0 Kudos

Hi Vila,

My file is in the following format -

abc.dcu.gz

When I am using zip.mode --- gunzip ; its giving me the following error -

Zip: error occured during processing: java.io.IOException: Not in GZIP format

MP: exception caught with cause com.sap.aii.af.lib.mp.module.ModuleException: Zip: error occured during processing: java.io.IOException: Not in GZIP format