Biztalk FTP adapter Append Functionality.

Recently I got an very interesting problem. A customer wanted to implement the File Append Functionality that is present in the File Adapater using the File Adapater. There are a business requirement that would not allow him to create a new file on the ftp server.

As an workaround we tried to Use the Before Put and After Put to execute the Append Command. But that did not work. The FTP adapter however would have none of this. It would log an error stating Command not Understood.

 However when I ran same commands from the Command prompt I was able to append to the file on the ftp server. After some digging and some help from the Biztalk Dev Team, I found that the  FTP protocol mandates that a PASV/PORT command be sent before any data transfer( RETR / STOR/ APPE ). In this case before the append ( APPE ) command is sent we need to open a data connection by passing a PASV or PORT command specifically.

Further, the issue here is not the PASV command because After Put can take multiple ftp raw commands separated with ";" and this way user can place a PASV command in the AfterPut field before the APPE command. The main issue here is that we don't have any way of sending the local file data over the data connection once setup because AfterPut can handle only control channel based ftp commands.

Currently there is no way to implement this is the FTP adapater.

WorkAround

A suggested workaround would be to read the file using FTP, append to it and then post it back using FTP.