on 03-07-2016 10:22 PM
Hi All,
can anyone help me with the below requirement.
My scenario is from sender SFTP to Receiver Proxy. Is there any standard bean that can fulfill this requirement ,as i am not interested in Java code. Can we achieve this with standard module bean in SFTP sender channel.
I have gone through some of the blogs but did not found anything to meet my requirement
Note: No mapping involved in this.I have taken both sender and receiver structures with single Data type.
Appreciate the quick reply.
Thanks,
Gayathri.
Gayathri,
Please use this Java Mapping.
package com.test;
import com.sap.aii.mapping.api.*;
import java.io.*;
public class MyJavaMapping extends AbstractTransformation {
@Override
public void transform(TransformationInput transformationInput, TransformationOutput transformationOutput) throws StreamTransformationException {
try {
InputStream inputstream = transformationInput.getInputPayload().getInputStream();
OutputStream outputstream = transformationOutput.getOutputPayload().getOutputStream();
//Read input content into byte array.
byte[] b = new byte[inputstream.available()];
inputstream.read(b);
//Make payload as attachment.
Attachment newopAttachment = transformationOutput.getOutputAttachments().create("FileName.txt", b);
transformationOutput.getOutputAttachments().setAttachment(newopAttachment);
//Write Message Type XML to proxy.
outputstream.write("<root><xml>XML payload to proxy</xml></root>".getBytes());
} catch (Exception exception) {
getTrace().addDebugMessage(exception.getMessage());
throw new StreamTransformationException(exception.toString());
}
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gayathri,
Sometimes it's a good idea to pose a workaround that it can reduce considerably the developing time. Why don't do a SFTP - FTP/NFS scenario where the receiver filesystem was accessible for your ECC?, in this way the scenario is a piece of cake and if the PI is in the DMZ with the ECC to share a filesystem via NFS or FTP it will not be a big risk.
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Inaki,
FTP is not recommended by my client, they are going only with SFTP. My scenario here is SFTP to SOAP proxy inbound. And more over they don't want to place the files in Application server( AL11) instead of that they want me to pass the text file as it is to ECC as an attachment.
Thanks,
Gayathri.
Hi Gayathri,
Did you tried the payload swap bean in sender channel?
regards,
Harish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gayathri
PayloadSwapBean will only work if you have at least one attachment in the message. For your case, with just one .txt file, you won't have any attachments.
As it is right now, you cannot achieve your requirement (attachment in message to proxy) with standard functionality. You will need Java coding either in a custom module or mapping.
Regards
Eng Swee
Hi Gayathri,
Please checck this beautiful blog by Ashutosh Upadhyay.
He has explained java mapping procedure to add the attachment along with payload.
Let me know in case you have issues in implementing this solution.
Regards
Anupam
Hi Anupam,
In my requirement there is now payload involved it is a simple SFTP to Proxy scenario.
Where I need to pick the text file from SFTP location and has to process the same file to ECC with inbound proxy as an attachment.
I have created one dummy source structure, and Receiver structure with one filed like below.
Please let me know the code and where Do i need to insert the same.
Thanks,
Gayathri.
User | Count |
---|---|
92 | |
11 | |
10 | |
9 | |
9 | |
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.