cancel
Showing results for 
Search instead for 
Did you mean: 

HOW - PayloadSwapBean - adding attachments to the message? :-)

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

anyone knows how can we add an attachment

to the XI message so that later on

we can use PayloadSwapBean to send it somewhere

with the standard XML message?

can we do it in the mapping step?

(in what kind of mapping?)

Regards,

michal

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Michal,

I guess we can add attachment in module since we get full saop message there.

In mapping program, i doubt it as it gives access to payload only, not the whole SOAP message.

Hope the following code from a document How to create Adaptermodule can help.

// create a second attachment for the receiver mail adapter

try {

// get the XI message from the environment

Message msg = (Message)

inputModuleData.getPrincipalData();

// create a new payload

TextPayload attachment = msg.createTextPayload();

// provide attributes and content for the new payload

attachment.setName("Attachment");

attachment.setContentType("text/plain");

attachment.setText("Hello World");

// add the new payload as attachment to the message

msg.addAttachment(attachment);

// provide the XI message for returning

inputModuleData.setPrincipalData(msg);

} catch (Exception e) {

// raise exception, when an error occurred

ModuleException me = new ModuleException(e);

throw me;

Regards,

Satish

MichalKrawczyk
Active Contributor
0 Kudos

Hi Satish,

thanks for the code

Regards,

michal

Answers (0)