cancel
Showing results for 
Search instead for 
Did you mean: 

Creating Attachments

Former Member
0 Kudos

Hi,

I am creating a FIile to SOAP scenario.

I have to send the file that is picked up through the SOAP adapter to a 3rd party system.

I understand that SOAP adapter can only send the file as a attachment.

My Requirement

I want to read the file using the FILE adapter. The file i am going to read is a .pdf

After the file is read i want to convert the file to a attachment.

Please help me, how to go about in making the file picked up as a attachemt.

Thanks,

Vignesh

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi vignesh

This is quite confusing

How you want it to happen. Soap adapter picking file ? or file adapter?

In File to SOAP case

I assume File adapter picks the file. Now when you pick a file as an attachment then you cannot access that attached file in mapping. This will go as attachment to SOAP and use Keep attachments in SOAP.

To read the file adapter attachments use Additional file option in file adapter. You need to keep the same file name as file in File Name field. and mock the extension as well

Thanks

Gaurav

Former Member
0 Kudos

Hi Gaurav,

I am doing a File to SOAP scenario only.

I do not want any mapping to be carried out on the file.

If the name of the file i should pick up is xi_input.pdf

I have to use the same file name in the "Additional files" option?

Wil this make the xi_input.pdf as a attachment ?

If this is possible, i dont need to use Payloadswap bean in the SOAP receiver adapter rgiht ?

Former Member
0 Kudos

HI Vignesh

If you dont have to do anything in mapping then no problem. You can read this file as attachment and send as an attachment through SOAP.

Read this file as additional file

if the name of PDF is xi_input.pdf. Just keep a dummy xml file xi_input.xml to trigger this process and additional file to be picked.

if you can have more than one file coming in this location its good to use processing sequence by name and type binary

file list <xi_input.pdf>

set parameters

<xi_input.pdf>.namePart -> ".pdf"=".xml"

<xi_input.pdf>.optional -> YES

<xi_input.pdf>.type -> BIN

You don't need to use PayloadSwapBean for this requirement

I think it can be done without IR objects as well. Only ID is sufficient for this. Give it a try !!

Thanks

Gaurav

Edited by: Gaurav Bhargava on Dec 6, 2008 11:59 AM

Answers (1)

Answers (1)

Former Member
0 Kudos

Vignesh

Best Idea would be create an Attachment to the XI message using Adapter Module and Later use the Payload SwapBean to send it to SOAP Adapter as attachment with standard XML message.

Use the Following Code to add an Attachment in the Adapter Module :

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

Ganga