SFTP connectivity using HCI/HCP Integration services
Dear SCN Friends,
I would like to share knowledge on SFTP connectivity using HCI/HCP Integration services.I’m assuming most of you might have already worked on it in PI/PO.So I’m going to focus only on key areas where we expect some guidance .
HCI acts as SFTP client in both pull and push .
SFTP adapter uses the SSH protocol to transfer files.So to mutually identify who is SFTP server and who is SFTP client ,need to exchange public keys/certificates between client and server.
Below are the steps for certificate exchange between HCI and SFTP server.
1)Request SAP to share SFTP client public key .
2)SAP will generate public and private key and store it in HCI key store and share public key to you.
3)Share above public key to team who is hosting SFTP server.
4)Request SFTP server public key,host name and public key algorithm from the team who is hosting SFTP server .
5)Share above public key to SAP ,they will store in known_host file .
If anybody wondering are these steps valid for sender or receiver ? Here is the answer .This setup is enough for both the both directions 🙂
Now we can jump into Iflow build.Now you might be wondering does HCI/SFTP adapter supports all options that we have in PI/PO ? No,but it supports all basic features that we expect in SFTP adapter.
For below requirements,you might feel bit difficult.
1)I want to write output file name same as input filename .Is it possible ? If yes ,How ?
Ans:Yes .It’s possible.Keep filename blank.
2)I want to read my input filename dynamically.Is it possible ? If yes ,How ?
3)I want to write output filename dynamically.Is it possible ? If yes ,How ?
Ans:Yes.It’s possible.Below is an example for your reference.
Use case:I need to set my output file as Inputfilename.xml by reading input file name
My input filename is CPSalesAll.csv , I need to set it to CPSalesAll.xml
I’m using below piece of code in a groovy script to read and set filename dynamically .
def OldFileName = message.getHeaders(); def value = OldFileName.get("CamelFileName").replace('csv','xml'); message.setHeader("CamelFileName",value);
4) Does HCI/SFTP sender polling flexible enough to read files ?
5)What Authentication modes does HCI/SFTP adapter supports?
Basic Auth and Certificate based Auth
Rest of the SFTP adapter configurations are pretty straight forward .Just go through SAP HCI documentation if you stuck with any doubts.
I have one question. Where to place the above script on HCI Integration flow to change the file name extension dynamically?
How can I read file dynamically based on filename,for eg. i have multiple files for order at server and i need to add them back as an attachment to respective order,so how can i get the respective file.