Technical Articles
Try SFTP scenarios in CPI with your own SFTP server using Google Cloud
Recently I have done SFTP based scenarios using SAP CPI trial tenant. I will share here in this blog, how you can set up SFTP server and connect to SFTP using SFTP channel.
I have followed below blog to create my SFTP server on Google Cloud. It worked without any issues.
https://medium.com/@biancalorenpadilla/sftp-google-cloud-storage-d559fd16e074
Once you are done with SFTP server setup, you can start creating your iflow in your CPI tenant. To configure SFTP channel, we need SFTP connection details and user credentials. Of course you have to deploy host key of SFTP in CPI Tenant under known_host keys.
You can get the host key by doing connection test from your tenant. Unfortunately this connection test is not available in trial account.However I have tested this from my company partner tenant. Once connection is successful you can copy the key and deploy.
check this blog for getting host key
https://blogs.sap.com/2017/08/03/cloud-integration-how-to-setup-secure-connection-to-sftp-server/
If you are using only trial account, then you can copy host file from SFTP server. Host file will be in folder /etc/ssh. You just have to copy the file and create known_host file and deploy in CPI.
you can remove the instance text which comes at the end.
your known_host key should look like this.
Now you can deploy your known_host in CPI under path Operation view ->Manage Security -> Security Material section.
For testing purpose I have created below flow. Sending some payload from content modifier step.
receiver channel config.
Files in SFTP server after deploying flow.
Similarly you can configure and test sender scenario.
Hope this will help you to test SFTP scenarios in CPI on your own like consuming public soap/rest/odata services.
Big thanks to SAP for providing trial CPI access 🙂
References
2521381 – Configuring SFTP for SAP HCI: Creating “known_hosts” Files
GCP - SFTP comes with cost ?
It is free for 12 months. But you have to provide your card details while registering
Is your CPI Trial account a free version, if yes how did you get this?
https://blogs.sap.com/2019/06/19/sap-cloud-platform-integration-is-now-available-on-cloud-foundry-cf-environment/
Hi Muniyappan,
Very good blog , thanks.
One suggestion to add below details :
for known_host and Credential , please add that it needs to be deployed in
Operation view ->Manage Security -> Security Material section.
Best regards,
Yashpal
Hi Muni ,
Have you observed , the external ip gets changed every time you restart the instance in GCP . So we need to change the known_host file as well . Is this the same in your case?
Thanks,
Manoj
Hi Manoj,
Yes. That is correct. I also faced same behavior.
You can make use of static ip assignment in order to avoid this situation.
https://cloud.google.com/compute/docs/ip-addresses/reserve-static-external-ip-address
thanks . i was also facing the same issue after server stop and restart.
Hi,
Any idea if there are any special roles needs to be assigned to the tenant configured in the Cloud Foundry free trial version for sending a SOAP request via soap UI.
I am getting an authorization error for the same. The user has Admin and developer roles already assigned.
you should not use your user id. you have to use the credentials from step 7. Have you done step 7?
https://blogs.sap.com/2019/06/10/self-service-enablement-of-cloud-integration-service-on-cloud-foundry-environment/
Hey its working after I configured the steps from the blog.
Thank you so much, really appreciate the quick help.
Regards,
Saurabh Mishra
Hi,
Very good blog!!
I am getting directory access issue while reading the SFTP file from GCP.
Error is: com.jcraft.jsch.SftpException: No such file
Directory given: "/home/[username]"
Any suggestions how to resolve this issue. I am performing the sender SFTP scenario.
Thanks for your reply.
Best regards,
Guru Dutt
Hi Guru,
Could you please create a folder under /home/username and try?
Hi Muniyappan Marasamy,
I have resolved the issue by changing the Linux user in GCP. After which I created a folder in which I stored the file to read from.
Thanks for your inputs!!
Best regards,
Guru Dutt
Hi Guru ( Infact my name is alos guru 🙂 )
I am able to write to a file in SFTP server in GCP as explained in the blog, however when I try to read a file from the GCP I am having exceptions popping out like "GenericFileOperationFailedException: Cannot change directory to: home" I have used home/<username>/<subfolder> as my directory and I have a single txt file in the subfolder to read. It somehow fails. I am using the sender scenario like you.
Can you elaborate when you said you could solve it by changing the user in Linux, what did you actually do?
With Regards
Guru Prasad
Hi All,
I managed to solve my own issue that I had when reading the file from SFTP server on Google Cloud Platform.
If the file is in the directory /home/<username>/<directory> ( eg : /home/guru/out) then in the SFTP source in CPI for Directory just key in the <directory> and not the full path and for file name can use the wildcard.
Regards
Guru
Hi Team,
I followed the above steps, now I am stuck in credential Name . What is the credential name I have to provide in SFTP adapter? Kindly help
Thanks
Rathish
You have to deploy user credentials in security material and use that name in channel.
it will be similar to https://help.sap.com/docs/SAP_CPQ/f80fbcd4f1c74232839c30ce26886f07/10c34a97b2d34549826f1053d8af3d04.html?version=2108