on 01-14-2014 7:49 AM
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 .
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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(
new
BufferedInputStream(fis));
ZipEntry entry;
while
((entry = zis.getNextEntry()) !=
null
) {
System.out.println(
"Unzipping: "
+ entry.getName());
int
size;
byte
[] buffer =
new
byte
[
2048
];
FileOutputStream fos =
new
FileOutputStream(entry.getName());
BufferedOutputStream bos =
new
BufferedOutputStream(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();
}
}
}
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 ....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.