on 09-12-2011 3:37 PM
i want to pick the zip file which consists some 2,3 files inside it. and send as it is to mail as an attachment.what i did is
i have taken one zip file,,, "testing.zip" inside it i have "test1.txt" & "test2.csv"
i created sender CC ,,in that i used module payloadzipbean and unzipped and called the file adapter.. created reciever CC as mail ..used same payload module now here i zipped all the payloads.
Result..i see the attachment coming as "test1.txt.zip" ..here i can see inside this zipfile my original file names as "test1.txt"&"test2.csv" as i enabled ASMA in both CC.
issues:i am unable to get the original file name like "testing.zip" ,,
can anyone help me in this.
Regards,
Loordh
Please check this thread
Pick ur zipped original file using file adapter without conversion.
/people/william.li/blog/2006/09/08/how-to-send-any-data-even-binary-through-xi-without-using-the-integration-repository
Then use reciever mail adapter with PayloadSwapBean to send the original file as attachment.
Regards
Raj
Edited by: raj sharma on Sep 13, 2011 5:38 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Use PayloadZipBean so that you would be able to send the zip as an attachment.
/people/stefan.grube/blog/2007/02/20/working-with-the-payloadzipbean-module-of-the-xi-adapter-framework
Regards,
Naveen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Yes.
You use File sender Adapter for picking the file, use the code depicted in the blog as adapter module for receiver mail adapter and include it after mail adapter.
Read the below instruction
This adapter module can be used in sender mail adapter.
It reads the attachment name from the content type of the MIME header and writes
it to an adapter specific message attribute (ASMA). Put this module after the standard
mail adapter module If the incoming mail has several parts,
then the PayloadSwapBean should be used before this module.
Hope it helped you.
Ramesh
As discussed with my team,,the requirements are like follows i need to pick the zip file and send as attachment to mail .i am using mail package at target side bcoz i need to generate to,cc,bcc ..it may change in future also ..so i want to go for java mapping or udf for this..kindly can anyone give me an idea to proceed.
Hi all,
as i posted last time my requirement ,i am going with java mapping for my scenario. i am using this code .
http://wiki.sdn.sap.com/wiki/display/XI/Dynamicfilenameforpass-through+scenario
this is working perfect for zip file (file to file) scenario. but my scenario is file to mail ..as i need to send this to mail package there it is throwing error.i am getting "zip file name as attachment properly but when i try to open it is giving error in zip file." this is what i modied code ..i am able to see my messge in sender CC and reciever CC..any java experts please help on this.
try {
// create XML structure of mail package
String output = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ "<ns:Mail xmlns:ns=\"http://sap.com/xi/XI/Mail/30\">"
+ "<Subject>" + mailSubject + "</Subject>"
+ "<From>" + mailSender + "</From>"
+ "<To>" + mailReceiver + "</To>"
+ "<Content_Type>multipart/mixed; boundary=\"" + boundary + "\"</Content_Type>"
+ "<Content>";
out.write(output.getBytes());
// create the declaration of the MIME parts
//First part
output = "--" + boundary + CRLF
+ "Content-Type: text/plain; charset=UTF-8" + CRLF
//+ "Content-Transfer-Encoding: 8bit" + CRLF
+ "Content-Disposition: inline" + CRLF + CRLF
+ mailContent + CRLF
//Second part
+ "--" + boundary + CRLF
+ "Content-Type: Application/zip; name=" + attachmentName + CRLF
//+ "Content-Transfer-Encoding: base64" + CRLF
+ "Content-Disposition: attachment; filename=" + attachmentName + CRLF + CRLF;
out.write(output.getBytes());
//Source is taken as attachment
copySource(in, out);
out.write("</Content></ns:Mail>".getBytes());
} catch (IOException e) {
throw new StreamTransformationException(e.getMessage());
}}
protected static void copySource(InputStream in, OutputStream out)
throws IOException {
byte[] bbuf = new bytehttp://in.available();
int bblen = in.read(bbuf);
if (!(bblen < 0)) {
//String sbuf = new String(bbuf);
//String encoded = Base64.encode(sbuf);
// replace all control characters with escape sequences
//sbuf = sbuf.replaceAll("&", "&");
//sbuf = sbuf.replaceAll("\"", """);
//sbuf = sbuf.replaceAll("'", "'");
//sbuf = sbuf.replaceAll("<"<");
//sbuf = sbuf.replaceAll(">", ">");
out.write(bbuf);}}
Thnaks for all who gave me some ideas..i have finished this ..the procedure is i have encoded incoming zip file into BASE64 and passed to mail package as content.so i have used 2 mappings ...1.java mapping 2.message mapping.
java mapping output will go to input to message mapping...in message mapping target structure will be mail package....solved for to,cc,bcc in message mapping.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.