Adapters, BizTalk, Orchestrations, SFTP

Using the SFTP Adapter in a Dynamic Send Port

In the comments to a previous blog post announcing the Blogical SFTP Adapter I got a question regarding the use of the SFTP Adapter in a Dynamic Send Port. The answer I was forced to give was that the SFTP Adapter did not in its current state support being used in a Dynamic Send Port. Not being one to shy away from a challenge, and eager to show we listen to feedback, I have added the artifacts and code necessary to support Dynamic Send Ports. Mikael has included my change and it will be available in the next release of the adapter to codeplex. The problem was that the adapter had no propertyschema, and so there was no way to access the properties needed from within an orchestration, and no support in the adapter for loading properties from anywhere but its configuration. It now has those things. The installer and source download now includes a propertyschema and the adapter looks at the message context if the config is null, which it will be in a Dynamic Send Port.


So, to use the SFTP adapter from your orchestration and a Dynamic Send Port, use something similiar to the below code:

DynamicSendPort(Microsoft.XLANGs.BaseTypes.Address) = “SFTP://server:22/”;
MsgOut(BTS.OutboundTransportType) = “SFTP”;
MsgOut(Blogical.Shared.Adapters.Sftp.Schemas.host) = “server”;
MsgOut(Blogical.Shared.Adapters.Sftp.Schemas.portno) = 22;
MsgOut(Blogical.Shared.Adapters.Sftp.Schemas.user) = “user”;
MsgOut(Blogical.Shared.Adapters.Sftp.Schemas.identityfile) = @”c:mysftpkeyfile.ppk”;
MsgOut(Blogical.Shared.Adapters.Sftp.Schemas.remotefile) = “OUT_%SourceFileName%”;

I’d post a full downloadable sample, but there really isn’t anything more to it then that. You should however take a look at the propertyschema, available in both the binary download and the source, to see which properties you can use.

Adapters, BizTalk

BizTalk SFTP Adapter

A while ago I wrote about different kinds of file transfer protocols that contained the acronym FTP in one way or another, and what they really meant. I mentioned that I had worked with these different protocols. Now the BizTalk Adapter that we used for SFTP has been made available online by Mikael, who was the one responsible for developing it. Considering what the going rate is for BizTalk adapters I’d say that this is highly generous. I know of at least one company that charges several tens of thousands of dollars for their BizTalk SFTP Adapter. Why not save a buck or two for the projects release party? The only thing I have against this adapter is the SharpSsh library it uses, which is a port from Java that has resulted in some C# code that I just don’t like. However I must say that we have been using it in production for some time and it hasn’t failed us yet. As usual though, don’t take my word for it. If you plan to use this adapter test to see that it fits your requirements (as you should with everything in your solution). Read more here.

Adapters, BizTalk

What kind of FTP did you say you used?

I’d just like to make a small note about protocol acronyms, and the importance of knowing the correct acronym when naming your BizTalk adapter so that someone planning to (re)use your adapter knows what it’s really about. The case I’d like to highlight refers to FTP, and is something I’ve been forced to drill myself into when working in an environment where several different types of similar sounding acronyms are present.


FTP, the File Transfer Protocol, is used to transfer data from one system to another. The base implementation of this protocol sends all data (including username and password) in clear text through the wire. There are however protocol enhancements for securing this transfer using SSL. This is called FTP over SSL, which is more generally refered to as FTPS (or FTP/SSL). There is also the option of securing your FTP transfer by tunneling it though a SSH session. Though since FTP is a multi channel protocol this in many implementations just protects the control channel (ie the username and password) and sends the data unprotected. However this differs from implementation to implementation, and in some cases both control codes and data is protected. This is refered to as Secure FTP, but is not to be confused with SFTP, which is used when talking about the SSH File Transfer Protocol, which has really nothing to do with FTP. Confusing isn’t it? 😉


Wikipedia har more info. FTP (and FTP over SSH), FTPS, SFTP.

Adapters, BizTalk

BizTalk File Adapter and Windows Fileshare Limitations

This post is based on something we experienced recently. When we activated some more file receive locations against a machine to which we previously had a bunch of receive locations configured, after a while they began to become disabled, one after the other (but not all). The message in the eventlog states:

The receive location “Xxx Receive Location” with URL “\servershare*.*” is shutting down.
Details:”The FILE receive location \servershare*.* exhausted the network retry attempts.”

The network was up, security settings was unaltered and besides – some of the receive locations still worked. Curious.


Turns out, it’s as much a Windows Server 2003 (and other OS’es) issue as it is a BizTalk issue, and you can just as likely get it in another type of application as in a BizTalk application. The problem is based upon limitations in the number of open requests or commands between two machines. There are limits to both how many connections you are allowed to another computer and how many connection you allow another computer to make to you (ie both outgoing and incomming).


The reason this is more likely to occur in a BizTalk application is that when listening on a share BizTalk registers for change events, and for each receive location one such event will be register. The default limit for the number of active commands is 50. Luckily there is a knowledgebase article (ID:810886) describing how to get around this issue (ie raise the limit). Also for those of you reading the Pro BizTalk 2006 book, there is a section in the book called File Tuning (pages 445-447) that talks about this and also highlights some other issues with the file adapter. The book suggest setting the values to 2048 instead, but doesn’t really say why. The highest possible value is 65000. My suggestion is to set it to a value where you are sure you have covered the number of active receive locations and have room for additional connections used by send port and other type of access using fileshares – only you know what that is. Also for a BizTalk environment, do this to both the BizTalk server and the fileserver you are connecting to. 


Below is the summary of what the knowledgebase describes, in registry file format (valid for Windows 2003 Server machines):

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServiceslanmanserverparameters]
“MaxMpxCt”=dword:00002048

[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServiceslanmanworkstationparameters]
“MaxCmds”=dword:00002048