{"id":182,"date":"2018-08-07T22:12:00","date_gmt":"2018-08-07T21:12:00","guid":{"rendered":"http:\/\/wp.bizoir.dk\/?p=182"},"modified":"2018-08-07T22:12:00","modified_gmt":"2018-08-07T21:12:00","slug":"new-sftp-adapter-in-biztalk-2016","status":"publish","type":"post","link":"https:\/\/wp.bizoir.dk\/?p=182","title":{"rendered":"New SFTP adapter in Biztalk 2016"},"content":{"rendered":"<h1>WCF WinSCP-based SFTP Adapter<\/h1>\n<p>Since Microsoft now supplies a SFTP Adapter with Biztalk Server 2016, we thought we might as well try it out instead of using the Blogical one (which we have had several problems with).<\/p>\n<p>It is relatively straightforward to use it in static sendports and receivelocations &#8211; the only thing we miss, is a possibility to use temporary filenames during transmission, which it does not support &#8211; only temporary folders.<\/p>\n<p>However, it does not seem to be documented how to use the adapter in a dynamic sendport (at least, we have been unable to find it)<\/p>\n<p>As documented, the SFTP Adapter uses the WinSCP program to do its actual work and specifically, it requires the WinSCPnet.dll to do its work.<\/p>\n<p>Microsoft have implemented the WCF adapter in this DLL which wraps the calls to WinSCP.<\/p>\n<p><span style=\"color: #0000ff;\">C:\\Program Files (x86)\\Microsoft BizTalk Server 2016\\Microsoft.BizTalk.Adapter.Sftp.dll<\/span> &#8211; Assembly version 3.0.1.0<\/p>\n<p>The Adapter loads the WinSCPnet DLL in the class <span style=\"color: #0000ff;\">SftpHelper<\/span>.<\/p>\n<p>The dynamic properties can be found in the class <span style=\"color: #0000ff;\">SftpOutputChannel<\/span> Method <span style=\"color: #0000ff;\">AddPropertiesFromMessageContext<\/span>.<\/p>\n<table>\n<tbody>\n<tr>\n<th>Context Property<\/th>\n<th>Description<\/th>\n<\/tr>\n<tr>\n<td>http:\/\/schemas.microsoft.com\/BizTalk\/2012\/Adapter\/sftp-properties#ClientAuthenticationMode<\/td>\n<td>this.sendPropertyBag.ClientAuthenticationMode = (ClientAuthenticationMode) Enum.Parse(typeof (ClientAuthenticationMode), property.Value.ToString());<\/p>\n<p>enum Password, PublicKeyAuthentication, MultiFactorAuthentication<\/td>\n<\/tr>\n<tr>\n<td>http:\/\/schemas.microsoft.com\/BizTalk\/2012\/Adapter\/sftp-properties#UserName<\/td>\n<td>Either specify UserName and Password, or specify a keyfile in PrivateKeyFile<\/td>\n<\/tr>\n<tr>\n<td>http:\/\/schemas.microsoft.com\/BizTalk\/2012\/Adapter\/sftp-properties#Password<\/td>\n<td>Password<\/td>\n<\/tr>\n<tr>\n<td>http:\/\/schemas.microsoft.com\/BizTalk\/2012\/Adapter\/sftp-properties#PrivateKeyFile<\/td>\n<td>Full path to Private Key<\/td>\n<\/tr>\n<tr>\n<td>http:\/\/schemas.microsoft.com\/BizTalk\/2012\/Adapter\/sftp-properties#PrivateKeyPassword<\/td>\n<td>Password to the private key, if it is password protected<\/td>\n<\/tr>\n<tr>\n<td>http:\/\/schemas.microsoft.com\/BizTalk\/2012\/Adapter\/sftp-properties#AccessAnyServerHostKey<\/td>\n<td>If False, host fingerprint must be specified. If True, all hosts will be accepted<\/td>\n<\/tr>\n<tr>\n<td>http:\/\/schemas.microsoft.com\/BizTalk\/2012\/Adapter\/sftp-properties#SSHServerHostKeyFingerPrint<\/td>\n<td>Specify the fingerprint of SSH servers HostKey, if &#8220;AccessAnyServerHostKey&#8221; is False<\/td>\n<\/tr>\n<tr>\n<td>http:\/\/schemas.microsoft.com\/BizTalk\/2012\/Adapter\/sftp-properties#AppendIfExists<\/td>\n<td>If False, transfer will fail if a file with the filename already exists. If True, the contents will be appended to the existing file<\/p>\n<p>We have not been able to make the &#8220;AppendIfExists&#8221; work. If this property is true, the adapter issues a get command for the filename, and if the file does not exist yet (first transfer), then the transmission fails.<\/td>\n<\/tr>\n<tr>\n<td>http:\/\/schemas.microsoft.com\/BizTalk\/2012\/Adapter\/sftp-properties#TargetFileName<\/td>\n<td>The name of the file created on the SFTP server. You can use the macros specified below<\/td>\n<\/tr>\n<tr>\n<td>http:\/\/schemas.microsoft.com\/BizTalk\/2012\/Adapter\/sftp-properties#TemporaryFolder<\/td>\n<td>this.sendPropertyBag.TemporaryFolder = property.Value.ToString();<\/td>\n<\/tr>\n<tr>\n<td>http:\/\/schemas.microsoft.com\/BizTalk\/2012\/Adapter\/sftp-properties#ProxyAddress<\/td>\n<td>Address of a proxy-server, if you need to use one, or blank.<\/td>\n<\/tr>\n<tr>\n<td>http:\/\/schemas.microsoft.com\/BizTalk\/2012\/Adapter\/sftp-properties#ProxyUserName<\/td>\n<td>Username and password for the proxy-server, or blank if they are not needed<\/td>\n<\/tr>\n<tr>\n<td>http:\/\/schemas.microsoft.com\/BizTalk\/2012\/Adapter\/sftp-properties#ProxyPassword<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>http:\/\/schemas.microsoft.com\/BizTalk\/2012\/Adapter\/sftp-properties#ProxyPort<\/td>\n<td>Port for the proxy-server<\/td>\n<\/tr>\n<tr>\n<td>http:\/\/schemas.microsoft.com\/BizTalk\/2012\/Adapter\/sftp-properties#ProxyType<\/td>\n<td>this.sendPropertyBag.ProxyType = (Microsoft.BizTalk.Adapter.Sftp.ProxyType) Enum.Parse(typeof (Microsoft.BizTalk.Adapter.Sftp.ProxyType), property.Value.ToString());<\/p>\n<p>enum None, SOCKS4, SOCKS5, HTTP<\/td>\n<\/tr>\n<tr>\n<td>http:\/\/schemas.microsoft.com\/BizTalk\/2012\/Adapter\/sftp-properties#EncryptionCipher<\/td>\n<td>this.sendPropertyBag.EncryptionCipher = (EncryptionCipher) Enum.Parse(typeof (EncryptionCipher), property.Value.ToString());<\/p>\n<p>enum Auto, AES, Arcfour, BlowFish, TripleDES, DES<\/td>\n<\/tr>\n<tr>\n<td>http:\/\/schemas.microsoft.com\/BizTalk\/2012\/Adapter\/sftp-properties#Log<\/td>\n<td>this.sendPropertyBag.Log = property.Value.ToString();<\/td>\n<\/tr>\n<tr>\n<td>http:\/\/schemas.microsoft.com\/BizTalk\/2003\/system-properties#OutboundTransportLocation<\/td>\n<td>Contains the full EndPointAddress of the server &#8211; on the form sftp:\/\/servername:port<\/p>\n<p>this.ParseSftpUrl(property.Value.ToString());<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>OutboundTransportLocation needs to be &#8216;sftp&#8217; (case insensitive compare)<\/p>\n<h2>Supported macros<\/h2>\n<table>\n<tbody>\n<tr>\n<th>Macro<\/th>\n<th>Value<\/th>\n<\/tr>\n<tr>\n<td colspan=\"2\">Use fixed context-property<\/td>\n<\/tr>\n<tr>\n<td>%MessageID%<\/td>\n<td>http:\/\/schemas.microsoft.com\/BizTalk\/2003\/system-properties#BizTalkMessageID<\/td>\n<\/tr>\n<tr>\n<td>%SourceFileName%<\/td>\n<td>http:\/\/schemas.microsoft.com\/BizTalk\/2003\/file-properties#ReceivedFileName<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\">Use the macro as the name of a context-property<br \/>\nUse the contextproperty with the namespace namespace http:\/\/schemas.microsoft.com\/BizTalk\/2003\/system-properties# with the macroname (nix the percent-signs) appended<\/td>\n<\/tr>\n<tr>\n<td>%DestinationParty%<\/td>\n<\/tr>\n<tr>\n<td>%DestinationPartyQualifier%<\/td>\n<\/tr>\n<tr>\n<td>%SourceParty%<\/td>\n<\/tr>\n<tr>\n<td>%SourcePartyQualifier<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\">These macros formats either DateTime.Now or DateTime.UtcNow in the specified format<\/td>\n<\/tr>\n<tr>\n<td>%datetime%<\/td>\n<td>yyyy-MM-ddThhmmss<\/td>\n<\/tr>\n<tr>\n<td>%datetime_bts2000%<\/td>\n<td>yyyyMMddhhmmssf<\/td>\n<\/tr>\n<tr>\n<td>%datetime.tz%<\/td>\n<td>yyyy-MM-ddThhmmsszzz<\/td>\n<\/tr>\n<tr>\n<td>%time%<\/td>\n<td>hhmmss<\/td>\n<\/tr>\n<tr>\n<td>%time.tz%<\/td>\n<td>hhmmsszzz<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>WCF WinSCP-based SFTP Adapter Since Microsoft now supplies a SFTP Adapter with Biztalk Server 2016, we thought we might as well try it out instead of using the Blogical one (which we have had several problems with). It is relatively straightforward to use it in static sendports and receivelocations &#8211; the only thing we miss, &hellip; <a href=\"https:\/\/wp.bizoir.dk\/?p=182\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;New SFTP adapter in Biztalk 2016&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"aside","meta":{"footnotes":""},"categories":[21],"tags":[],"class_list":["post-182","post","type-post","status-publish","format-aside","hentry","category-biztalk","post_format-post-format-aside"],"_links":{"self":[{"href":"https:\/\/wp.bizoir.dk\/index.php?rest_route=\/wp\/v2\/posts\/182","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.bizoir.dk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.bizoir.dk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.bizoir.dk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.bizoir.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=182"}],"version-history":[{"count":14,"href":"https:\/\/wp.bizoir.dk\/index.php?rest_route=\/wp\/v2\/posts\/182\/revisions"}],"predecessor-version":[{"id":207,"href":"https:\/\/wp.bizoir.dk\/index.php?rest_route=\/wp\/v2\/posts\/182\/revisions\/207"}],"wp:attachment":[{"href":"https:\/\/wp.bizoir.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=182"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.bizoir.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=182"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.bizoir.dk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=182"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}