cancel
Showing results for 
Search instead for 
Did you mean: 

XI: Mail -> XI -> File, all attachments in folder

Former Member
0 Kudos

Hello Group!

I am working on the following scenario: Mail -> XI -> File (XI NW2004 SP19)

The mail adapter picks up the mails form the mail server and the file adapter should save the files to an existing folder. Basically the adapter works fine, but I have problems with attachments. The file adapter only save one file (the mail) to the folder. The attachments won´t be saved to the destination.

Then I found the Module PayloadZipBean (http://help.sap.com/saphelp_nw04/helpdata/de/45/da9358a1772e97e10000000a155369/frameset.htm). In the monitoring I can see all attachments in the payload. So I tried this module to zip all payload contents (as described in: /people/stefan.grube/blog/2007/02/20/working-with-the-payloadzipbean-module-of-the-xi-adapter-framework).

But it doesn´t work. No zip file will be created. Do I have to install the PayloadZipBean?

My settings:

Reg. Parameter:

Transport Protocoll: NFS

Message Protocoll: File

Adapter Engine: Integration Server

File name scheme: example.zip (it just works with .dat - but then only the mail)

File construction mode: Add Counter

Write mode: Directly

File Type: binary

Reg. Module:

Nr____Module Name________________Type___________________Module Key

1 - - - - AF_Modules/PayloadZipBean - - Local Enterprise Bean - - - - 1

2 - - - - CallSapAdapter - - - - - - - - - - - - Local Enterprise Bean - - - - 0

Module Key__Parameter Name__Parameter Value

1 - - - - - - - - - zip.filenameKey - - contentType

1 - - - - - - - - - zip.mode - - - - - - - zipAll

Can anyone help me?

Thanks in advance.

Kind regards,

Martin

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Stefan!

Thanks for your quick reply!

But I´m not sure if it works in my case.

Is it possible to save the mail-subject in in the ASMA FileName and save all attachments with the FileName (+plus counter)?

In your link is the following statement:

"These attributes can be accessed in routing and mapping by using the attribute namespace and the technical name of the attribute."

That means I have the possibility to access the attributes (FileName, Directory...) during the mapping and routing (is this receiver determination?). But how can I do this.

I think, here is a good example for file to file:

/people/jin.shin/blog/2007/04/27/sap-netweaver-xi-variable-substitution-with-adapter-specific-message-attributes-via-dynamicconfigurationbean

But when I try this, I don´t have the DynamicConfiguration in the header. Do I have to make some changes to the mail adapter?

Thanks a lot!

Martin

stefan_grube
Active Contributor
0 Kudos

First of all you cannot save all attachments with file adapter. If you want to store the attachments in the zip file, then you can use the content-type for storing the attachment names inside the zip file, but in this case the content-type of the attachments has to provide the file name. (You can check this inside the SXMB_MONI, where the content-type is listed).

When you want to use the subjet name as file name of the zip file, you have to activate ASMA in sender mail adapter and in receiver file adapter as well. You need a self-written UDF in mapping where you read the subject from the ASMA and write this to the file name in the file adapter.

I have not done this so far, so I cannot give you the Java code for this.

Regards

Stefan

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi Stefan!

Thanks a lot for your help.

Now, I guess I know how to handle it!

Kind regards,

Martin

Former Member
0 Kudos

Hi Stefan!

Hi Group!

Now the PayloadZipBean works. The reason was, that I try to use variable substition. Without this, it works.

But unfortunatelly, I need the variable substition. The name of the zip or of the target folder should have the name of the mail subject.

In your great blog

/people/stefan.grube/blog/2007/02/20/working-with-the-payloadzipbean-module-of-the-xi-adapter-framework

you use no variable substitution. Do you know how to handle it?

When I use the variable substitution, the following error appears:


com.sap.aii.af.ra.ms.api.DeliveryException: Error during variable substitution: 
com.sap.aii.adapter.file.varsubst.VariableDataSourceException: 
Caught SAXException while parsing XML payload: Fatal Error: com.sap.engine.lib.xml.parser.ParserException: XMLParser: 
No data allowed here: (hex) 50, 4b, 3(:main:, row:1, col:3)</

Settings of variable substituion:

File name scheme: %subject%.zip

Variable substitution: subject = payload:Mail,1,Subject,1

(this works without the PayloadZipBean)

In my opinion, the reason is the order of module and adapter.

At first, the module PayloadZipBean starts to zip all payloads in one zip. Then the file adapter starts and tries to use the variable substitution. But then there is no access to the first payload anymore --> error.

Does you or somebody else know, how to handle this?

Maybe there is a better solution without the PayloadZipBean. I just want to save all mail attachments to a file system with the name of the mail subject. Unfortunately with the file adapter only the first payload will be saved to the file system - maybe there is a better solution.

Thanks,

Martin

stefan_grube
Active Contributor
0 Kudos

Instead of variable substitution, you could use the ASMA. Here you have to do some Java code in mapping:

http://help.sap.com/saphelp_nw04/helpdata/en/43/0a7d1be4e622f3e10000000a1553f7/frameset.htm

Hope that helps

Stefan

stefan_grube
Active Contributor
0 Kudos

Is no file created at all, or is a file created which is no zip file?

In first case, check the audit log of the message, in second case apply a file name with .zip as ending.

Regards

Stefan

Former Member
0 Kudos

Hello Group,

I´m not sure if I need this PayloadZipBean module. The only thing I want is, to save all attachment files from a mail to an folder.

Does anyone know, how to handle it with the file adapter?

Thanks a lot

Martin

Former Member
0 Kudos

Hi Ravi,

when I change the module name and aktivate, then no error appears!?

Where can I find the module in the VisualAdmin? I guess it should be in Services -> Deploy -> Application.

I couldn´t find an object like PayloadZipBean.

What do you mean with "specify the parameters for the metadata".

Thanks

Martin

ravi_raman2
Active Contributor
0 Kudos

Martin,

I would try by seeing if i can reference the payloadBean in the module tab, save and activate..if it works then its already there...

another way is to check in visual admin for installed apps...or on physical file system if you have access to both of these.

If its not there then you might have to use sdm to deploy that and specify the parameters for the metadata..

Regards

Ravi Raman