【问题标题】:BizTalk Json encoder and Dynamic PortsBizTalk Json 编码器和动态端口
【发布时间】:2016-11-04 05:22:46
【问题描述】:

我有一个需要通过动态发送端口发送 JSON 的场景。因此,我使用带有选项的 JSON 编码器创建了一个发送管道 移除外层信封 = true。

我有与我的动态端口关联的管道,并且管道同时具有 Xml 汇编器和 Json 编码器(我也尝试过不使用 xml 汇编器,结果是一样的)。

我的请求消息的构造形状具有以下代码:

varXml.LoadXml(
"<ns0:DataMigrationRequest xmlns:ns0=\"http://temp">"+
  "<ns0:DataSets>Local Products</ns0:DataSets>"+
  "<ns0:Country>Spain</ns0:Country>"+
  "</ns0:DataMigrationRequest>"
);

msgRequest = varXml;

msgRequest(WCF.SuppressMessageBodyForHttpVerbs)="POST"; 
msgRequest(WCF.TransportClientCredentialType) = "None";
msgRequest(WCF.AlgorithmSuite) = "Default";
msgRequest(WCF.SecurityMode)="Transport";
msgRequest(WCF.HttpMethodAndUrl)=@"POST"; 
msgRequest(BTS.IsDynamicSend) = true;

msgRequest(WCF.BindingType)="customBinding";
msgRequest(WCF.Action)="";
msgRequest(WCF.BindingConfiguration)=@"<binding name=""customBinding""><httpsTransport /></binding>";

msgRequest(WCF.EndpointBehaviorConfiguration) = @"
<behavior name=""customBehavior"">
    <CustomBehavior />
</behavior>";

Dynamic_Port(Microsoft.XLANGs.BaseTypes.Address) =     System.String.Format("https://localhost/temp");
Dynamic_Port(Microsoft.XLANGs.BaseTypes.TransportType)="WCF-Custom";  

每次我尝试发送消息时都会收到错误消息:

错误详情:System.Xml.XmlException:根级别的数据无效。

如果我将动态端口替换为静态端口,一切正常,并且我能够按预期发送消息。它只是不起作用是我作为动态发送。

肯定缺少某些东西,有人有任何可以提供帮助的提示吗?

【问题讨论】:

  • 哪个版本的 BizTalk?
  • 您也尝试过仅使用管道中的 XML 汇编器吗?如果这是引发错误的原因,那么这是一个问题。
  • 版本是 BizTalk 2013 R2。只有使用 XML 汇编器我没有任何问题。
  • 您是否使用命名空间 http://temp 和根 DataMigrationRequest 发布了架构? JSON 汇编器确实需要架构
  • 我看到在你的构造形状中你有 msgRequest(WCF.SuppressMessageBodyForHttpVerbs)="POST";这将抑制实际的主体,即有效负载,因此当 jsonencoder 尝试将 xml 转换为 json 时,那里什么都没有。通常,对于 GET 请求,消息正文会被抑制。

标签: json biztalk biztalk-2013r2


【解决方案1】:

我想我已经解决了这个问题。看来 WCF-Custom 只能处理 XML 消息,所以我用 WCF-WebHttp 替换。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-12-23
    • 1970-01-01
    相关资源
    最近更新 更多