Unzip using PayloadZipBean
Hi,
I was looking to use PayloadZipBean module to unzip a zipped file with three text files inside.
From the receiver adapter Audit log files, I see that the PayloadZipBean,is unzipping all the three files(first file as main payload and rest of the two files as additional payloads), but while writing the files, it only writes one file with the Main Payload content and the file name from File Name Scheme parameter.
In module configuration, i gave name as zip.mode and value as unzip. Are there any other parameters where we can specify the names for additional files and also how do we extract other two files.
Already looked at 'SAP Note:965256 - XI 3.0 Adapter Framework Zip Module' where not much information is available on unzipping piece.
Thanks in advance.
Pradeep
I dont think you can use all the unzipped files as payloads. You might want to crate two scenarios where it writes all the unzipped files to disk (using receiver file adapter) then another file to X scenario as per your requirement.
VJ
Similar Messages
-
Unzip using Payloadzipbean/file content conversion
Experts,
I have a scnario, I get a zip file with .gz extension, unzip it read th file using file adapter.
I am using Payloadzipbean module to unzip(zip.mode = unzip).
The problem is File adapter converting the zip file into xml and unzipping the file.
How do I force File adapter to unzip first and do content conversion.
thanksHi man.
How did you solve this. I have to pick up a zip file with a .txt file then I need to convert this file to xml with module MessageTransformBean but Im getting this error:
com.sap.aii.messaging.adapter.trans.TransformException: Error converting Message: 'sun.io.MalformedInputException'; nested exception caused by: sun.io.MalformedInputException
This is my structure
row (1..n)
>TRANSPORTES (1)
>ENTREGAS (1..n)
I have configured the module tag in this way:
AF_Modules/PayloadZipBean - zip
AF_Modules/MessageTransformBean - transform
CallSapAdapter - 0
zip - zip.mode - unzip
transform - Transform.Class - com.sap.aii.messaging.adapter.Conversion
transform - xml.ENTREGAS.endSeparator - 'nl'
transform - xml.ENTREGAS.fieldFixedLengths - 1,30
transform - xml.ENTREGAS.fieldNames - TIPO,NUM_ENTREGA
transform - xml.ENTREGAS.keyFieldValue - E
transform - xml.TRANSPORTES.endSeparator - 'nl'
transform - xml.TRANSPORTES.fieldFixedLengths - 1,30
transform - xml.TRANSPORTES.fieldNames - TIPO,NUM_TRANSPORTE
transform - xml.TRANSPORTES.keyFieldValue - T
transform - xml.keyFieldType - CaseSensitiveString
transform - Transform.ContentType - text/plain;charset=utf-8
transform - xml.conversionType - StructPlain2XML
transform - xml.documentName - MPrueba_Zip
transform - xml.documentNamespace - http:/XXXXXX.es/XXXX/sap/prueba
transform - xml.keyFieldName - TIPO
transform - xml.processFieldNames - fromConfiguration
transform - xml.recordsetName - row
transform - xml.recordsetStructure - TRANSPORTES,1,ENTREGAS,*
If I use only the MessageTransformBean directly from .txt everything works ok!!!
What am I doing wrong???
Thanks a lot!!! -
Unzip file using PayloadZipBean in Sender FILE adapter
I am trying to unzip a flat file in Sender FILE adapter using PayloadZipBean.
I am getting mapping error. The problem is File adapter is reading data without unzipping. I am getting weird characters/data, so mapping error.
I searched all the blogs/ forum threads and help.sap.com, everywhere the focus is on zipping, not unzipping.
the file I have is with .gz extension, but I tried with .zip extension also.
Please help in resolving this issue.
Edited by: Gopal Janagama on May 2, 2008 11:42 PMGopal,
GZIP and ZIP format are slightly different, as stated here :
"GZIP compresses only one file and does not have a header. ZIP contains header information about what files are contained in the file."
So I'm not sure the PayloadZipBean supports GZIP format ... Try to ungzip and then zip its content and see if the bean works for it
Rgds
Chris -
Error while using PayloadZipBean module
hi,
For sending the data in zipped format in JDBC Adapter i used "PayloadZipBean" module.
While Communication channel Monitoring at Receiver end I am getting this Error:--
"Message processing failed. Cause: com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Path to object does not exist at loacalejbs, the whole lookup name is localejbs/loacalejbs/AF_Modules/PayloadZipbean."**
Is there any need to write this module in adapter engine?Hi,
Have a Look at these
Working with the PayloadZipBean module of the XI Adapter Framework
Zip-Transfer-Unzip: Increase the performance of your Java-ABAP applications
Regards
Seshagiri -
Controlling filenames using PayloadZipBean
Hello
I am struggling with names of the zipped files using payloadzipbean. The Scenario is as follows: we want to transfer an invoice including attachments to an external partner consisting of an xml message and one or more pdf files as attachments. the attachments are added to the message in an ABAP proxy on the sending R/3 system. The message is transferred to PI,where it si routed to an ftp communication channel. The xml message is zipped using the payloadzip bean and transferred to the external partner using ftp. The partner requires an approriate file extension to identify the types of files on the receiving side. Originally we managed this pay using the parameter zip.filenameKey and set it ContentType. The files inside the zip file are then named "untitled.xml" for the xml message and "untitled.pdf" for the attachments. However when there is more than one attachment the zipping of the file crashed, as both attachments have the same filename. We can fix this by adding an unique name to the attachment when it is attached to the proxy, and changing the zip.filenameKey to payloadName. The problem then is that the main payload file is called MainDocument without the .xml extension. I need to change the name of the payload or find another way to make the attachment filenames unique with zip.filenameKey set to ContentTyoe, Any suggestions ?
Eivind Langsæterit is a bit tricky.
You might have to code a module to build the attachments and then use zipbean to zip it for you.
to set the name of the main document you can have a look into the sinppet of code below;
Vector_attachementFileName contains the name for the attachment
attachmentFileMainPayload has the data of the main payload
XMLPayload MainDocumentPayload = message.createXMLPayload();
MainDocumentPayload.setContent(
this.attachmentFileMainPayload.getBytes());
message.setDocument(MainDocumentPayload);
Audit.addAuditLogEntry(
this.auditMKey,
AuditLogStatus.SUCCESS,
"Main Document Successfully Set");
TextPayload txtpayload = message.getDocument();
txtpayload.setContentType("text/plain");
txtpayload.setName(
this.Vector_attachementFileName
.elementAt(lengthOfVector - 1)
.toString());
Audit.addAuditLogEntry(
this.auditMKey,
AuditLogStatus.SUCCESS,
"File Created: " +
this.Vector_attachementFileName
.elementAt(lengthOfVector - 1)
.toString()); -
How do I estimate time takes to Zip/Unzip using java.util.zip ?
If I am compressing files or uncompressing zips using java.util.zip is there a way for me to tell the user how long it should take or for perhaps displaying a progress monitor ?
For unzip use the ZipInputStream and pass it a CountingInputStream that keeps track ofr the number of bytes read from it (you write this). This CountingInputStream extends fileInputStream and as such can provide you with information about the total number of bytes available to be read and the number already read. This can give a crude idea of how much work has been done and how much work still needs to be done. It is inaccurate but should be good enoough for a progress bar
As for zipping use the ZipOutputStream and pass it blocks of information. Keep track of the number of blocks you have written and the number you still need to write.
matfud -
Problem using payloadZipBean to unzip a file
I would like to run OS command to zip large amount of xml into one zip file before XI pick it up, then use unzip option in payloadZipBean to unzip all the xml files so XI can process them one by one from memory, this will reduce lots file I/O time.
But I am getting this warning message:
Warning Zip: message is empty or has no payload
But if I display this message in RWB, the only payload is this zip file.
Why the payloadZipBean is not unzipping this file as supposed to.Did you check this blog
/people/stefan.grube/blog/2007/02/20/working-with-the-payloadzipbean-module-of-the-xi-adapter-framework
Sameer -
Zipping multiple Payloads to single Zipfile using payLoadZipBean
Dear Friends,
Can you help me in doing this sceanrios:
I'm trying to send multiple payloads from source (selection
of multiple payloads is done by checking Advance selection for
Source file) to PI, that inturn Zip all Payloads in to a single Zip FIle.
(note: payLoadZipBean is giving individual zip file for every single payload but I want it all in single Zip file)
And also can I zip, Additional Files sent through File Adapter,
as these are not considered as payloads. Plz correct me If I'm wrong.
I request you plz dont paste any links to blogs or forums.
I'm trying to create a module to perform this scenario,plz suggest me better answers, in case module develpment is not required.
Dear Stefen, I hope I will get a good answer from you soon.
And thanks for suggesting me to post a thread for this issue.
Thanks in advance
Praveen K KurniDear Sameer,
I did studied the SAP note;
By using these parameters
Module Key: zip
Parameter name: zip.mode
Parameter value: zipAll
Module Key: zip
Parameter name: zip.filenameKey
Parameter value: contentType
Module zips all payloads as individual zipfiles
for ex:
my files are:
1. abc1.xml
2. abc2.xml
3. abc3.xml
module payLoadZipBean zips these payloads as
1. abc1.zip
2. abc2.zip
3. abc3.zip
But I want all the files to be zipped in to single zipped file:
let say abc_all.zip
Thanks any way
Praveen K Kurni -
Zip Payload using PayloadZipBean Module Processor
Hi,
I'm using AF_Modules/PayloadZipBean in module processor of Receiver SOAP adapter to compress/zip the message payload. I've used the following module key parameters :
Parameter Name Parameter Value
zip.Mode zipAll
zip.filenameKey contentType
In the adapter engine monitoring from RWB I can see the following warning message :
Warning Zip: message is empty or has no payload
But I can see the msg payload from the RWB message monitor as expected.
Can anyone please throw any light on this issue?
Thanks in advance,
DipankarHi Stefan,
Can you please explain what you meant by transfer-encoding gzip?
Actually the requirement is to receive xml message in compressed zipped format along with digital signature. As I understand using the ModuleProcessor which you mentioned in your blog I can send zipped message (using File Adapter I've actually achieved the result as mentioned in your blog. So thanks a lot for that!). But in file adapter I can't use digital signature. So how to satisfy both the requirements using a single adapter (and maybe using some module processors over it)?
Thanks for your help!
Dipankar -
hello friends,
Please help me out...iam in urgent help..iam not getting answer for this .. Using zlib java..
I have a zipfile named prabhu.zip
It contains
prabhu\prabhuimage\imagefiles
right now iam able to unzip only files in current folders..i mean prabhu
i want to unzip subfolders also...eg prabhuimage folder..
RIght now only files in current folder is getting unzipped..
please understand this and help me out my friend..
Thanks and Regards,
Prabhuhello friends,
Please help me out...iam in urgent help..iam not getting answer for this .. Using zlib java..
I have a zipfile named prabhu.zip
It contains
prabhu\prabhuimage\imagefiles
right now iam able to unzip only files in current folders..i mean prabhu
i want to unzip subfolders also...eg prabhuimage folder..
RIght now only files in current folder is getting unzipped..
please understand this and help me out my friend..
Thanks and Regards,
Prabhu -
Problem in deleting Zip files unzipped using java.util.zip
I have a static methos for unzipping a zip file. after unzipping the file when i am trying to delete that file using File.delete()its not getting deleted. but when methods like exist(). canRead(), canWrite() methods are returning true what can be the possible problem ? i had closed all the streams after unzipping operation Please go through the following code.
public static boolean unzipZipFile(String dir_name, String zipFileName) {
try {
ZipFile zip = new ZipFile(zipFileName);
Enumeration entries = zip.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = (ZipEntry) entries.nextElement();
// got all the zip entries here
// now has to process all the files
// first all directories
// then all the files
if (entry.isDirectory()) {
// now the directories are created
File buf=new File(dir_name,entry.getName());
buf.mkdirs();
continue;
}// now got the dirs so process the files
entries = zip.entries();
while(entries.hasMoreElements()) {
// now to process the files
ZipEntry entry = (ZipEntry) entries.nextElement();
if (!entry.isDirectory()){
File buf=new File(dir_name,entry.getName());
copyInputStream(
zip.getInputStream(entry),
new BufferedOutputStream(
new FileOutputStream(buf)));}
} catch (IOException e) {
e.printStackTrace();
return false;
return true;
now i am trying to call this method to unzip a zip file
public static void main (String arg[]){
unzipZipFile("C:/temp","C:/tmp.zip");
java.io.File filer = new File("C:/tmp.zip");
System.out.println (filer.canRead());
System.out.println (filer.canWrite());
System.out.println (filer.delete());
Please tell me where my program is going wrong ?Thanks .. the problem is solved... i was not closing the Zip file .. rather i was trying to close all the other streams that i used for IO operaion ... thanks a lot
-
Third party component for zipping and unzipping using password
Hi EveryBody
I am working on a project wherein i have to zip and unzip a file using password .I downloaded a java component ,but was unable to efficiently unzip my zip files using password.
Can any body suggest me a java library/component that will accept a file and do zipping and unzipping with a password.
I will also be really grateful ,if somebody suggest me a component that would do the same above functionality using Streams.
Eagerly waiting for your replies ASAP.
--KiranHI
I am also facing the same sort of problem. Could any body please give some solution for this.
Ravi -
How to unzip a zip archve
Hi, strange I didn't find any answer in the forum, so I paste my code :
You should first read the zip file and put its content into i_zip_file_xstring variable of type xstring
DATA lo_zip TYPE REF TO cl_abap_zip.
DATA lt_zip_file TYPE cl_abap_zip=>t_files.
DATA ls_zip_file TYPE LINE OF cl_abap_zip=>t_files.
DATA l_xstring TYPE xstring.
CREATE OBJECT lo_zip.
CALL METHOD lo_zip->load
EXPORTING
zip = i_zip_file_xstring
EXCEPTIONS
zip_parse_error = 1
OTHERS = 2.
LOOP AT lo_zip->files INTO ls_zip_file.
WRITE : / ls_zip_file-name, ls_zip_file-date, ls_zip_file-time, ls_zip_file-size.
* unzip file, put its unzipped content into L_XSTRING
CALL METHOD lo_zip->get
EXPORTING
name = ls_zip_file-name
IMPORTING
content = l_xstring
EXCEPTIONS
zip_index_error = 1
zip_decompression_error = 2
OTHERS = 3.
*>>>>>>>>>>>>>>
* PUT YOUR CODE HERE TO PROCESS the L_XSTRING variable which contains each unzipped file
*<<<<<<<<<<<<<<
ENDLOOP. -
Hi all,
I want to unzip the file and extract the xml. To iterate over the xml file to get
the values and stored into tables.
so far i 'had done this,
To unzip the file,
final int BUFFER = 2048;
try
DomParserExample dom = new DomParserExample();
BufferedOutputStream dest = null;
String dir = "C:/New/employee1.zip";
FileInputStream fis = new FileInputStream(dir);
ZipInputStream zis = new ZipInputStream(new BufferedInputStream(fis));
ZipEntry entry;
while((entry = zis.getNextEntry()) != null)
System.out.println("Entry = " + entry);
dom.runExample(entry); // To iterate the xml file
System.out.println("Extracting: " +entry);
int count;
byte data[] = new byte[BUFFER];
// write the files to the disk
FileOutputStream fos = new FileOutputStream(entry.getName());
dest = new BufferedOutputStream(fos, BUFFER);
while ((count = zis.read(data, 0, BUFFER)) != -1) {
dest.write(data, 0, count);
dest.flush();
dest.close();
zis.close();
} catch(Exception e) {
e.printStackTrace();
} The problem is, i want to pass the xml file to parse method. If anyone come across my
requirement. please give me a suggestions.I have employee1.zip file inside it contains employee.xml. I want to Extract zip and pass the xml file
to another method. In that method to iterate logic should be written.
This entry will print "employee1/employee.xml"
}{code
ZipEntry entry;
while((entry = zis.getNextEntry()) != null)
System.out.println("Entry = " + entry);
System.out.println("filename" + entry.getName());
dom.runExample(entry); // to pass entry
}public void runExample(ZipEntry entry) {
System.out.println("Inside runExample");
//parse the xml file and get the dom object
parseXmlFile();
//get each employee element and create a Employee object
parseDocument();
//Iterate through the list and print the data
printData(); -
Does Sender Mail Adapter support "PayloadZipBean" module
Hi everyone,
I have a scenario where, I get the email with an zip file as an attachment and I need to extract this file and send across. There is no mapping transformation done here, only I need to forward the attached file to the file server.
Zip file always contains 1 file and is a text file.
so Its an Email to File Scenario.
Can I send the zip file as it is without unzipping i.e., send the attachment as iit is to the file server?
If I want to unzip the file, does the module "PayloadZipBean" support in case of sender mail adapter. ?
Thanks,
VarunHi Varun,
Use "PayloadZipBean " Module at Receiver Communication Channel in the Module Tab Set the "Module Key.mode = unzip"
and Receiver communication Channel file should be "FileName.txt".
http://help.sap.com/saphelp_nw2004s/helpdata/en/bd/c91241c738f423e10000000a155106/frameset.htm
Regards,
Naga.
Maybe you are looking for
-
Winacd, why doesn't apple use something like this, or advertise it?
I mean it completely fixes the power on issue and adds extra features fur tuning the montitor itself. I dont quite understand since the ACD needs this in order to function correctly on a windows PC. Here is the link if anyone is interested. http://so
-
Post Payment not Clarify but on Account for payment batch
Hi, this is FI-CA account current. My customer processes distribution batches. The Clearing control finds the account but not an open item with same due date. Now the payment is posted for clarification. In clarification we can set a flag to post it
-
In Hungary with iPhone5. Apartment has wifi. iPad connected no problem and uses wifi, I think. In the upper right hand corner it just says iPad. She ever I turn on the iPhone, service is automatically provided by Vodafone. I have verizon in the U
-
Web sharing starts but will not turn off
I have enabled web sharing and been running successfully for a long time, recently upgraded to Lion. The problem I have now is that I can turn Apache on through the Web Sharing prefs but it will not turn off, technically that not true as the instance
-
I really want to know how to change my display name in skype community such that it is different from my Skype ID i.e thompson_lau Appreciate for your help