BizTalk:在为应用程序导出绑定时,从自定义适配器的发送端口清除密码

使用我为BizTalk Server 2010制作的适配器导出包含发送端口的应用程序时,我在清除密码时遇到问题.

发送端口使用我根据Microsoft.Samples.BizTalk.Adapter.Common BaseAdapter(v.1.0.2)制作的适配器.

TransmitLocation.xsd和TransmitHandler.xsd架构都使用AdapterFramework密码特定字段,两者都定义为:

    <xs:element minOccurs="1" default="" name="passwordField">
      <xs:simpleType>
        <xs:annotation>
          <xs:appinfo>
            <baf:designer xmlns:baf="BiztalkAdapterFramework.xsd">
              <baf:category _locID="mailAuthIndstillingerKategori">Password related category</baf:category>
              <baf:displayname _locID="passwordName">Password:</baf:displayname>
              <baf:description _locID="passwordDescription">Password description.</baf:description>
              <baf:editor assembly="%BTSROOT%\\Developer Tools\\Microsoft.BizTalk.Adapter.Framework.dll">Microsoft.BizTalk.Adapter.Framework.ComponentModel.PasswordUITypeEditor</baf:editor>
              <baf:converter assembly="%BTSROOT%\\Developer Tools\\Microsoft.BizTalk.Adapter.Framework.dll">Microsoft.BizTalk.Adapter.Framework.ComponentModel.PasswordTypeConverter</baf:converter>
            </baf:designer>
          </xs:appinfo>
        </xs:annotation>
        <xs:restriction base="xs:string">
          <xs:maxLength value="50" />
        </xs:restriction>
      </xs:simpleType>
    </xs:element>

一些google-hits提到在应该清除的元素上设置’vt =“1”’属性应该可以解决问题.我在调用ValidateConfiguration()时尝试设置/添加此属性.但是配置-SQL作为字符串返回,然后在插入< CustomProps>之前进行转义. xml,在绑定文件中导出.

我已经尝试指定注册表项中的SendHandlerPropertiesXML和SendLocationPropertiesXML的AdapterConfig应该使用以下< CustomProps>,并使用vt =“1”属性,希望它能清除端口的整个绑定属性(不是最佳,但比让某人导出密码更好的解决方案):

SendHandlerPropertiesXML : <CustomProps><AdapterConfig vt="1"/></CustomProps>
SendLocationPropertiesXML : <CustomProps><AdapterConfig vt="1"/></CustomProps>

导出具有已配置发送端口的应用程序时,特定XML如下所示:

<TransportTypeData>&lt;CustomProps&gt;&lt;AdapterConfig vt="1"&gt;&amp;lt;Config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&amp;gt;&amp;lt;passwordField vt="1"&amp;gt;CLEARTEXTPASSWORD;lt;/passwordField&amp;gt;&amp;lt;uri&amp;gt;SMTP://NOT-USED&amp;lt;/uri&amp;gt;&amp;lt;/Config&amp;gt;&lt;/AdapterConfig&gt;&lt;/CustomProps&gt;</TransportTypeData>

每次导出绑定时,都会调用适配器的重载方法:ValidateConfiguration(),但是无法判断这是在配置适配器时,还是在导出绑定时,这意味着:您不能破坏密码在返回的xml-string中,因为它在配置时也会破坏密码.

还有其他内置适配器可以执行此操作(E.G.:SMTP适配器),我确信这是我误解的基本内容.但任何帮助或指针都会非常有帮助.

最佳答案 我注意到CodePlex上的
Blogical Sftp Adapter使这项工作成功,我已经能够复制它了.

您应该做的就是在密码元素上添加type =“baf:Password”.

您可以参考他们的架构here.

点赞