Skip to Content
avatar image
Former Member

CSV file attachment to REST Service

Hi Experts , My scenario is to send CSV file from SAP SFTP to REST as attachment .

Since there was a need to send an attachment to the REST Webservice , I had to use http_aae adapter and create an attachment manually in Java mapping which was the same content as the payload pickedup by the SFTP Adapter.

When the data is being sent to the receiver system it goes in as below content with the filename Sample_1tst.csv . I had to check the Set Multipart, otherwise it does not provide an option to keep attachments .


Content-ID: <>

Content-Type: application/json Content-Disposition: attachment;filename="Sample_1tst.csv"

Content-Description: Sample_1tst.csv


Content-ID: <Har_Sample_1tst.csv>

Content-Disposition: attachment;filename="Sample_1tst.csv"

Content-Type: text/plain

Content-Description: Sample_1tst.csv

H,111,332.1,22537.7,,Container ship,,,



H,222,978.4,7563.1,,Air freight,,,

D,222,ZZ-AW56-1,10,5,10000,Gas Chromatograph,,


I have tried using the SOAP Receiver Adapter as well with the keep attachments option and I got the file sent to the Webservice with the same content . Can you please assist how my scenario can be fixed where only the content is sent to the receiver REST Service ?

Below is the code used in Java mapping to create the attachment

String namespace1 = "";

DynamicConfigurationKey KEY_FILENAME = DynamicConfigurationKey.create(namespace1,"FileName");

String dynfilename = conf.get(KEY_FILENAME);

InputStream inStream = input.getInputPayload().getInputStream();

byte[] byarray = new byte[inStream.available()];;

Attachment att = outAtt.create(dynfilename,"text/plain", byarray);


Regards, Nick

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Feb 06, 2017 at 11:30 AM


    Please check this link


    Siji Anup

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 12, 2017 at 09:44 AM

    Hello Nick,

    I read your posts regarding the SFTP to REST transmission you created a while ago and was wondering if you could share some advices. We have a simillar scenario where we need to send a file from ECC to Amazon bucket and don't know where to start. Could you share some info from your experience in creating this transmission?

    Thank you in advance!


    Add comment
    10|10000 characters needed characters exceeded