cancel
Showing results for 
Search instead for 
Did you mean: 

Set attachmentID in java mapping not coming in receiver file name

Former Member
0 Kudos

Hi Experts,

I am trying to create attachment using java mapping and creating the file in target using SFTP adapter, but the content ID which i set in java mapping is not coming to receiver file name in target directory, it is just writing file name as 'Attachment'.

Java mapping:


OutputAttachments outputAttachements = transformationOutput.getOutputAttachments();

  String attachmentID = "Done.txt";

  String attachmentContent = "Done";

  String contentType = "text/plain" + ";charset = \"UTF-8\";" + "name=\"" + attachmentID + "\"";

  Attachment attachment = outputAttachements.create(attachmentID, contentType, attachmentContent.getBytes());

  outputAttachements.setAttachment(attachment);

Please help me if you already done this before, appreciate your help.

Regards,

Rachana.

Accepted Solutions (1)

Accepted Solutions (1)

former_member181985
Active Contributor
0 Kudos

Hi Rachana,

Have you enabled Read attachments option in interface/operation mapping

//BR,

Praveen Gujjeti

Former Member
0 Kudos

Thanks Praveen for the reply, yes i have enabled read attachments option in operation mapping.

Regards,

Rachana.

former_member181985
Active Contributor
0 Kudos

It could be SFTP adapter default behavior. How many attachments you are having for a given message. May be you should try with more than one attachment to see what names you are getting in the SFTP server

//BR,

Praveen Gujjeti

Former Member
0 Kudos

Hi Praveen,

I have created two attachments in java mapping and SFTP adapter creates two files with file names  Attachment and Attachment_1, but i already got another attachment for that message which i am picking from sender as additional file, for that attachment SFTP adapter is creating same file name as source file name, only the attachments which i am creating using java mapping is a problem.

Thanks in Advance,

Rachana.

anandvithal
Active Participant
0 Kudos

Hi Rachana,

If you have used Integrated configuration in ID and if your PI system is dual stack, then change it to classical scenario and test the interface again.

Thanks,

Anand

Former Member
0 Kudos

Thanks Anand, I changed to classic scenario and it worked, is there any way to get it right in integrated configuration also or is it a bug?

Regards,

Rachana.

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Rachana,

I had a similar requirement, in your SFTP file receiver enable ASMA and check FileName. The idea is to create the attachment via UDF, set the FileName via DynamicConfiguration and then use PayloadSwapBean by using the content type. The file should have the same name as your content ID.

swap.keyName content-type

swap.keyValue text/plain

Regards,

Mark

anandvithal
Active Participant
0 Kudos

Hi Rachana,

Not sure if this is a bug or somthing but i have faced this issue. Check this blog for details

http://scn.sap.com/community/pi-and-soa-middleware/blog/2013/09/16/risks-in-migrating-to-ico-there-a...

Thanks,

Anand

Answers (0)