on 10-30-2008 1:55 PM
Hi,
I am using the mail adapter to receive an e-mail into PI. This e-mail has an attached CSV file.
First, I am using the PayloadSwapBean to swap the application playload to the attachment payload
Second, I am using the MessageTransformBean to transform the CSV file into an XML document
These are both working fine and the message is then passing into the relevant message mapping.
However, I would like to be able to use the attachment filename in the message mapping.
Can anyone advise how to do this for the mail adapter ?
I've done it loads of times for the file adapter but never the mail adapter (when using attachments) so I am a bit stumped.
Any advice greatly received.
Cheers
Colin.
Hi Colin,
You can use xslt mapping for converting the payload into a csv file and also for setting the filename for the attachment. Use Content Type and Content Disposition in the xslt itself and in the Content Disposition specify your filename.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
think you will need to write a custom module that reads the filename of the attachment and then puts it into some field in the main payload.
This blog has the code snippet to show how to dynamically set the name of the attachment. There should be a similar method to read the attachment name. ( I think there is a getName )
Don't have the java doc on me now, but will try to look up as well.
Regards
Bhavesh
I have created an adapter module for receiver mail adapter in which i wanted dynamic filenames
I think you can get the file name from content disposition or may be getName method
.
check the snippet for hints for adapter module using getName
Object obj = arg1.getPrincipalData();
msg = (Message) obj;
XMLPayload xmlPayload = msg.getDocument();
String FileName = xmlpayload.getName();
where arg1 is the parameter supplied by function
public ModuleData process(ModuleContext arg0, ModuleData arg1)
in the adapter module
Hi Progirl,
I want to dynamically set the name of attachment in receiver mail Communication Channel.
Example: IN__9907211000004_4048454000005_20081211_01000000002643
The first two numbers 9907211000004 & 4048454000005 I want to read it from the message
20081211 this is the date and
And againg this number 01000000002643 is read from message.
I read from your response. You had created adapter module for the similar purpose. Can you share it. Since I am new to writing Adapter Module.
Thank You in Advance.
Mukhtar
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.