none
How to connect to a SFTP receive location with credentials RRS feed

  • Question

  • Hi

    I want to connect to a https receive location using biztalk. This is the first time I am trying to connect to such a receive location and therefore have no idea on how to do it. It has credentials to login and then a folder directory and file mask to get the required input file. the full address looks like the following template:

    ftp.domain.co.uk

    username and password are provided to login and dig further

    input file directory: /Test/Pickup

    file name format: OUTPUTddmmyyyy.txt

    the above location is connected successfully using CUTE FTP.

    Any information on how to connect to the above receive location would be very appreciated.

    Regards


    manibest



    Thursday, January 7, 2016 10:22 AM

Answers

All replies

  • Hi,

    Your title says HTTPS receive location, but you are referring to an FTP server. My answer will assume you're trying to pick up files from an FTP server. Have you read this article? It's pretty straightforward. Let us know if you have any specific challenges.

    https://msdn.microsoft.com/en-us/library/aa559095.aspx


    Best regards, Kjetil :) Please remember to click "Mark as Answer" on the post that helps you. This can be beneficial to other community members reading the thread.

    Thursday, January 7, 2016 11:04 AM
  • Opps! You are right, Kjetil. It is an FTP location.

    I am using biztalk server 2013 R2 and have already tried the ftp as well as sftp adapters to connect to this location but both fail.

    FTP adapter throws the following error:

    The adapter "FTP" raised an error message. Details "Unable to connect to FTP server "ftp.domain.co.uk" as user "<username>". Inner Exception details: "No FTP server found on the specified address. ". ".

    whereas FTPS adapter throws the following error:

    The Messaging Engine failed to add a receive location "Receive Location1" with URL "sftp://ftp.domain.co.uk:22/Test/Pickup/OUTPUT*.txt" to the adapter "SFTP". Reason: "Microsoft.BizTalk.Adapter.SftpInvoker.SftpException: Unable to initialize SFTP connection. Ensure that the specified server's configuration details are correct.

    Could there be a firewall issue or something i am missing before i configure the receive location?

    Regards


    manibest

    Thursday, January 7, 2016 11:18 AM
  • The BizTalk server where your FTP receive host instance is running is not able to connect to the FTP server. Please check your CuteFTP connection again from the same BizTalk server, and let us know if it works.

    Best regards, Kjetil :) Please remember to click "Mark as Answer" on the post that helps you. This can be beneficial to other community members reading the thread.

    Thursday, January 7, 2016 11:36 AM
  • the ftp is not connecting from biztalk server. I think it is a firewall issue. I will get the firewall opened for related ports on related ip addresses and will try again. I will be back here once it is done.

    You may suggest if I am missing anything else.

    Thank you so much.

    Regards


    manibest

    Thursday, January 7, 2016 11:52 AM
  • Hi,

    Thank you for posting in MSDN forum.

    You can set FTP receive location adapter variables in the BizTalk Server Administration console. If properties are not set in the receive location, the default receive handler values set in the BizTalk Server Administration console are used. 

    Before completing the following procedure you must have already added a receive port.

    The FTP adapter in BizTalk Server 2013 R2 supports reading and writing data from a secure FTP server. The adapter provides support for file transfer from an FTP server over Secure Sockets Layer (SSL)/Transport Level Security (TLS). 

    With BizTalk Server 2013 R2, the FTP adapter supports downloading of files from read-only file locations.

    I would suggest please have a look into below MSDN article for configuration the FTP receive location,

    How to Configure an FTP Receive Location


    Thanks,

    If my reply is helpful please mark as Answer or vote as Helpful.

    My blog | Twitter | LinkedIn

    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

    Thursday, January 7, 2016 6:35 PM
    Moderator
  • Hi

    After configuring the firewall I used the ftp adapter again to pick the file. Following is the error I am getting this time:

    The adapter "FTP" raised an error message. Details "Unable to connect to FTP server "ftp.domain.co.uk" as user "username". Inner Exception details: "The receive operation timed out. ". ".

    Previously I was getting the following error:

    The adapter "FTP" raised an error message. Details "Unable to connect to FTP server "ftp.domain.co.uk" as user "username". Inner Exception details: "No FTP server found on the specified address. ". ".

    I can connect to the ftp server from Biztalk server using command prompt and get to the files successfully. Just unable to get them using biztalk.

    I have configured the ftp as below. Please inform if I am missing anything or done something wrong:

    Regards


    manibest

    Friday, January 8, 2016 11:00 AM
  • Hi,

    Seems your configuration looks good, though still please confirm the firewall setting. I have already configured FTP receive location for one of my project and below are the details, Please check the same.


    Thanks,

    If my reply is helpful please mark as Answer or vote as Helpful.

    My blog | Twitter | LinkedIn

    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

    Friday, January 8, 2016 11:23 AM
    Moderator
  • Thanks for your reply.

    I copied your configurations and ran the application, but received the same error

    The adapter "FTP" raised an error message. Details "A failure occurred when parsing the remote folder listing. Inner Exception details: "The data connection could not be established. ". ".

    Then I changed the configurations as under and now i think it has gone a step forward - reading the filename - but still throwing a new error this time.

    Error I am getting this time as as under:

    The adapter "FTP" raised an error message. Details "Unable to receive the file "OUTPUT04122015.TXT" from the FTP server.  The error that occurred was "A stream read or write operation failed because the stream is in an error state. ". ".

    How can i resolve this please?


    manibest

    Friday, January 8, 2016 12:58 PM
  • Good to know you moved one step forward. For error 'A stream read or write operation failed because the stream is in an error state.' I would suggest please have a look into below thread, same issue have discussed there and I am that will help you solve your issue,

    A stream read or write operation failed because the stream is in an error state

    Thanks,

    If my reply is helpful please mark as Answer or vote as Helpful.

    My blog | Twitter | LinkedIn

    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

    Friday, January 8, 2016 7:18 PM
    Moderator
  • Hi Manibest,

    Are you able to connect to the server using simple FTP clients ex. Filezilla or WinSCP?

    Best regards 

    Rasmus Jaeger

    Monday, January 11, 2016 8:53 AM
  • Hi

    Requirement:I want to "copy" files (not "cut" or "consume") from receive location and paste to send location within a specific time frame on daily basis. Each day, BizTalk should copy and paste all files "only once" and then again copy and paste all files only once the next day, and so on. The name of the files to copy may or may not be same each day in the receive location. The size of the files is in KBs.

    Receive location
    An FTP location

    Send location
    A shared location on local network

    Approach

    I have slightly changed the ftp settings and My receive FTP Transport Properties are set as under:
    Polling
    Delete After Download = No
    Enable Timestamp comparison = No
    Interval = 10
    Redownload Interval = 0
    Unit = Minutes

    Tuning Parameters
    Receive Data Timeout: 90000
    Temporary Folder:

    Besides, I am also using "Enable service window" from 01:00:00 to 06:00:00

    Send FILE Transport Properties
    Copy mode: Create New

    Issues

    The whole solution is quite intermittent. Although it works and copy the files over very very occasionally (like once in 50 times), I keep getting the following list of Warnings/Errors quite frequently:

    1) Warning: The adapter "FTP" raised an error message. Details "A failure occurred when parsing the remote folder listing. Inner Exception details: "The data connection could not be established. ". ".
    2) Warning: The adapter "FTP" raised an error message. Details "The adapter recovered from recent failures. The Event Log Error Threshold count reset. ".
    3) Warning: The adapter "FTP" raised an error message. Details "Unable to receive the file "OUTPUT*.TXT" from the FTP server.  The error that occurred was "A stream read or write operation failed because the stream is in an error state. ". ".
    4) Error: The Messaging Engine received an error from transport adapter "FTP" when notifying the adapter with the BatchComplete event. Reason "Safe handle has been closed".

    Question:
    How can I get rid of the above warnings and errors, please? this is the first time I am reading a file instead of consuming it. and first time I am getting these errors.

    -----------

    Kamlesh, Thanks for your message. I followed the link in your reply and changed the "Message count in DB" to 0 on both hosts i.e. "BizTalkServerApplication" and "BizTalkServerReceive32Host". The later is one specified to use for ftp receive locations in my biztalk server. But I was getting the same errors/warnings. The 2nd option in your link, I didnt know how to achieve this.

    Rasmus, I can connect to the server using cmd from my biztalk server.

    Kind regards


    manibest


    • Edited by MANIBEST Thursday, January 14, 2016 12:35 PM
    Thursday, January 14, 2016 12:34 PM
  • Hi Manibest,

    My comments on your FTP warnings and Error:

    First please change the FTP mode to PASSIVE.

    #1. This occurs usually when there is a network connection drop between biztalk and underlying connetions. Check this MS support article might be relevant. You should contact your network admins to take a look too.
    https://nobodydancing.wordpress.com/2013/11/19/ftp-adapter-causing-host-instances-to-crash/

    #2. It means that the adapter was disconnected and now it has regained connection.
    HOWEVER, sometimes even though the event log saying that the adapter was able to recover from recent failure and the error threshold count gets reset, the receive location was no longer able to consume any more data file.
    In order to process them again, disable and enable all the receive locations, or stop the application completely and restart it.
    http://www.codedigest.com/Articles/BizTalk/250_BizTalk_-_Errors_and_Warnings_Causes_and_Solutions.aspx

    #3. For warning three please have a look into below related thread and nice article by Rohit. 

    https://social.msdn.microsoft.com/Forums/en-US/5dfa3efd-10dd-40f8-88cd-7ce471af7bf2/a-stream-read-or-write-operation-failed-because-the-stream-is-in-an-error-state?forum=biztalkgeneral

    http://rohitt-sharma.blogspot.in/2011/07/ftp-adapter-issue-unable-to-receive.html
    Resolution: Change the Mode to "Passive" in the FTP adapter.

    #4. For warning four please have a look into below related thread.

    https://social.msdn.microsoft.com/Forums/en-US/5b6dc2f7-1945-430b-8023-0432db4bb82d/ftp-adapter-error?forum=biztalkgeneral

    http://social.technet.microsoft.com/wiki/contents/articles/7204.biztalk-server-list-of-errors-and-warnings-causes-and-solutions.aspx


    Thanks,

    If my reply is helpful please mark as Answer or vote as Helpful.

    My blog | Twitter | LinkedIn

    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

    Friday, January 15, 2016 11:25 PM
    Moderator
  • Hi all,

    Thank you so much for responding me and answering all my questions. 

    1) I was not able to use Passive mode as it was disabled from server side, hence it was failing all the time.
    2) In Active mode, the connection was very dangling and intermittent. And that's way I was getting these warnings and errors.

    Solution:

    Use SFTP adapter instead.

    1) Open SFTP firewall for biztalk. Use port 22 to configure the SFTP adapter receive port.
    2) setup the FTP server to send any data on port 22. Enable Passive mode from FTP server. Passive FTP allows a number of different ports through, the FTP Server admin needs to close down access on those ports and allowing only port 22 access.

    This works stunningly; consumes all specified files from the FTP server and copies to the local drive.

    Only one small issue left now is that I want to read data from receive location and copy to send location whereas biztalk SFTP adapter consumes (and deletes) the file from FTP server receive location. And I dont see any option on the SFTP adapter to force it Read-Only access. Can someone help me in this please?

    Thank you all so much.


    manibest

    • Marked as answer by MANIBEST Tuesday, January 26, 2016 5:12 PM
    Tuesday, January 26, 2016 5:12 PM