In some of our integration projects we may be asked to receive messages by e-mail.
It can be a simple XML message or even a large XML-IDOC. However in most cases
our message will not be a part of the e-mail’s payload but will be sent as a file attachment.
Can XI’s mail adapter handle such scenarios? Sure it can but with a little help
from the PayloadSwapBean adapter module. In this weblog I’ll demonstrate how to configure it.
We’d like to receive an XML message which will be sent as the e-mail attachment
and we’d like to process the message later on (mapping, etc).
At first we have to configure/create out mail communication channel.
Configure your mail communication channel:
– Transport protocol: POP3
– Message Protocol: XIPAYLOAD
– since we want to use our attachment we have to receive it first:
– change the QoS from Best effort to an asynchronus one:
– don’t forget to specify Default Parameters:
Now when the e-mail message comes to our account
we should see that it was picked up by our mail adapter:
If the message was picked up we can proceed further on.
– let’s open Messaging system:
– Display message bytes
to see how our e-mail message looks like:
We can see some attributes from the MIME header such
as Content-Disposition or Content-Description.
We can use them to tell our mail adapter to treat them as the main message and not the original payload.
With those values we can go back to our mail adapter and use them in the
When you configure the rest of the data inside Integration Directory and do some more tests
we should be able to see that the message which goes to our interface mapping
is actually the attachment and not the main payload itself.