on 02-03-2017 6:53 AM
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 .
--SAP_589a9ec8-e9db-11e6-b7b8-00000113c256_END
Content-ID: <payload-054aa967e9da11e6a15f00000113c256@sap.com>
Content-Type: application/json Content-Disposition: attachment;filename="Sample_1tst.csv"
Content-Description: Sample_1tst.csv
--SAP_589a9ec8-e9db-11e6-b7b8-00000113c256_END
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,,,
D,111,A-1579-227,10,3,400,Microtome,,
D,111,B-152-427,7,6,1200,Miscellaneous,,
H,222,978.4,7563.1,,Air freight,,,
D,222,ZZ-AW56-1,10,5,10000,Gas Chromatograph,,
--SAP_589a9ec8-e9db-11e6-b7b8-00000113c256_END--
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 = "http://sap.com/xi/XI/System";
DynamicConfigurationKey KEY_FILENAME = DynamicConfigurationKey.create(namespace1,"FileName");
String dynfilename = conf.get(KEY_FILENAME);
InputStream inStream = input.getInputPayload().getInputStream();
byte[] byarray = new byte[inStream.available()];
inStream.read(byarray);
Attachment att = outAtt.create(dynfilename,"text/plain", byarray);
outAtt.setAttachment(att);
Regards, Nick
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!
Iuliana
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.