cancel
Showing results for 
Search instead for 
Did you mean: 

Flat File to simple XML structure in Mail Sender Adapter

Former Member
0 Kudos

Hi,

I have a scenario, where I want to put the content of a flat file (text, no csv or similar), which is an attachement of an e-mail, into a simple XML structure: entire file content as content of one XML tag. E.g.:

file content:

"abcdefgh"

xml file:

<root>

<content>abcdefgh</content>

</root>

Do I need to use MessageTransformBean? Or is there an easiert way?

Thanks,

Torsten

Accepted Solutions (1)

Accepted Solutions (1)

dirk_roeckmann
Participant
0 Kudos

Hi Torsten,

if you need the content simply as a whole, you only need to exchange mail body and attachment. This is done with the

PayloadSwapBean.

http://help.sap.com/saphelp_nw04/helpdata/en/2e/bf37423cf7ab04e10000000a1550b0/content.htm

regards

Dirk

Former Member
0 Kudos

Hi Dirk,

thank you for the quick answer.

I tried already what you described, but I have the following problem: After receiving the mail I apply a message mapping, but during execution an exception is thrown (a simple mapping for testing: just copy the receiving field to another field).

Is there a special requirement, how the receiving message type must look like?

dirk_roeckmann
Participant
0 Kudos

Hi Torsten,

to be a 'real' message, the file content has to be wrapped into the message xml before attached to the email.

<ns:messagename xmlns:ns="namespace">

...

</ns:messagename>

regards

Dirk

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Dirk,

When we use MessageTransform, we can use ContentDisposition to specify, as to whether the payload has to go as an attachment or inline(as the mail itself.)

It could also be a text file. Right?

Just take a look at this..

http://help.sap.com/saphelp_nw2004s/helpdata/en/57/0b2c4142aef623e10000000a155106/frameset.htm

cheers,

Prashanth

dirk_roeckmann
Participant
0 Kudos

Hi Prashanth,

yes you are right, it can also be a text file.

Just ensure that in the end, the payload has the correct message format.

regards

Dirk

Former Member
0 Kudos

Hi everybody,

thank you for your support! I solved my problem using a mixture of your suggestions:

- I used SwapBean to use attachment

- I used TransformBean that way, that I'm converting the text string in my attachment into a basic XML-Structure (one field, field seperator "°").

Regards,

Torsten

Former Member
0 Kudos

Hi Dirk,

Just a small query. Only the main payload needs to be wrapped in XML right? The attachment can be a text file, right?

cheers,

Prashanth

dirk_roeckmann
Participant
0 Kudos

Hi Prashanth,

The PayloadSwapBean just takes the content of the attachment

as payload and expects it to be a valid message.

This means, the XML format has to be already in the attachment.

regards

Dirk

Former Member
0 Kudos

Hi Torsten,

Implementing MessageTransformBean is pretty similar to using PayloadSwapBean right?

Did u try using MessageTransform??If Yes, what does it say?

cheers,

Prashanth