on 01-23-2012 8:14 PM
Hello, I have a requirement to pick a file from a file server and send it to receiver as an email attachment as-is. The key is that the system should not read the contents of the file (payload). I'm unsure how to go about this! Any help in this regard is appreciated! Thanks!
Refer the configuration part of the receiver mail adapter in this [link|http://www.riyaz.net/sap/xipi-sending-emails-using-xi-mail-adapter/83/]. This might help you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You should find this helpful.....no need for a data/message definition or any mapping.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Guy & Baskar, thank you for your response!
I've implemented the interface configuration based on the blog in Guy's response. It works except for one problem. The attachment in the mail gets the name "untitled.xml". Since there is no mapping involved, is it possible to keep the name as the same as the input file? If an adapter module is to be written, can you please provide a sample? Thanks for your help!
You might want to see the dynamic configuration & variable substitution and see how that helps for renaming the filename.
Baskar, the file name from the sender is available to me in the Dynamic Configuration. I used DynamicConfigurationBean (in the receiver mail communication channel) to save the file name in a variable (message.interface) as mentioned in the link you shared today and attempted to use PayloadSwapBean to set the content disposition of the payload (as attachment;filename=message.interface) before the mail adapter module is invoked hoping that the file name in the variable "message.interface" would be assigned to the attachment .
I wasn't sure if this would work. The email attachment name still came out as "untitled.xml". Is there a way in receiver mail adapter to set the attachment file name from ASMA?
refer this thread
I created a Java bean to read the file name available in Adapter-Specific Message Attribute (ASMA) and set it in the payload content type. Here is the code to be put in the process() method in the Java Bean:
String fileName;
Message msg = (Message) inputModuleData.getPrincipalData();
Payload payload = msg.getDocument();
MessagePropertyKey mpk = null;
mpk = new MessagePropertyKey("FileName", "http://sap.com/xi/XI/System/File");
fileName = msg.getMessageProperty(mpk);
if(fileName == null) fileName="mytestfile.txt";
payload.setContentType("text/plain;charset = \"UTF-ISO-8859-1\";" + "name=\"" + fileName + "\"");
inputModuleData.setPrincipalData(msg);
} catch (Exception e) {
throw new ModuleException(e);
}
return inputModuleData;
Thanks to all those that helped me addressing the issue.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
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.