来自多次出现节点的BizTalk WCF WebHttp映射表单数据变量

来自多次出现节点的BizTalk WCF WebHttp映射表单数据变量,biztalk,biztalk-2013,Biztalk,Biztalk 2013,我的客户机的API要求通过HTTP POST将变量数据传递给他们。其中一些数据映射到URL,一些数据位于消息体表单变量中: Url: http://myclientapi.com/poNumber/111222/complete Message body variables: carrier=FEDEX&trackingNumber=4XXXXXX&shipDate=2018-12-17 WCF WebHttp端口似乎就是问题所在。为消息体变量(carrier、trackin

我的客户机的API要求通过HTTP POST将变量数据传递给他们。其中一些数据映射到URL,一些数据位于消息体表单变量中:

Url: http://myclientapi.com/poNumber/111222/complete

Message body variables: carrier=FEDEX&trackingNumber=4XXXXXX&shipDate=2018-12-17
WCF WebHttp端口似乎就是问题所在。为消息体变量(carrier、trackingNumber和shipDate)定义平面文件模式非常简单

我的问题是发送端口配置中poNumber的URL变量映射。我想这样做:

<BtsHttpUrlMapping>
    <Operation Name = "POSHIPPED" Method="POST" Url="/poNumber/{poNumber}/complete"/>
</BtsHttpUrlMapping>

由于只能通过属性模式提升单个引用节点,因此我无法将poNumber数据映射到映射消息体变量的相同节点,也不希望poNumber名称/值包含在消息体中


我是否已达到此特定适配器的限制条件?

假设您正在谈论的重复节点位于指向WCF WebHttp适配器的目标架构中,并且poNumber位于您正在映射的架构上的非重复节点中

您需要做的是创建一个属性模式,在其中将poNumber定义为MessageContextPropertyBase

属性架构

<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://Scratch.SO53891801_input" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns:ns0="http://Scratch.SO53891801propertyschema" targetNamespace="http://Scratch.SO53891801_input" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:annotation>
    <xs:appinfo>
      <b:imports>
        <b:namespace prefix="ns0" uri="http://Scratch.SO53891801propertyschema" location=".\SO53891801propertyschema.xsd" />
      </b:imports>
    </xs:appinfo>
  </xs:annotation>
  <xs:element name="Root">
    <xs:annotation>
      <xs:appinfo>
        <b:properties>
          <b:property name="ns0:poNumber" xpath="/*[local-name()='Root' and namespace-uri()='http://Scratch.SO53891801_input']/*[local-name()='poNumber' and namespace-uri()='']" />
        </b:properties>
      </xs:appinfo>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element name="poNumber" type="xs:string" />
        <xs:element name="carrier" type="xs:string" />
        <xs:element name="trackingNumber" type="xs:string" />
        <xs:element name="shipDate" type="xs:date" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://Scratch.SO53891801" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://Scratch.SO53891801" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="HttpRequestBody">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" name="FromValue">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="Id" type="xs:string" />
              <xs:element name="Value" type="xs:string" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>


将此属性架构添加到输入架构中。从orderNumber位于非重复节点中的输入中,可以将poNumber链接到属性

示例输入模式

<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://Scratch.SO53891801_input" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns:ns0="http://Scratch.SO53891801propertyschema" targetNamespace="http://Scratch.SO53891801_input" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:annotation>
    <xs:appinfo>
      <b:imports>
        <b:namespace prefix="ns0" uri="http://Scratch.SO53891801propertyschema" location=".\SO53891801propertyschema.xsd" />
      </b:imports>
    </xs:appinfo>
  </xs:annotation>
  <xs:element name="Root">
    <xs:annotation>
      <xs:appinfo>
        <b:properties>
          <b:property name="ns0:poNumber" xpath="/*[local-name()='Root' and namespace-uri()='http://Scratch.SO53891801_input']/*[local-name()='poNumber' and namespace-uri()='']" />
        </b:properties>
      </xs:appinfo>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element name="poNumber" type="xs:string" />
        <xs:element name="carrier" type="xs:string" />
        <xs:element name="trackingNumber" type="xs:string" />
        <xs:element name="shipDate" type="xs:date" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://Scratch.SO53891801" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://Scratch.SO53891801" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="HttpRequestBody">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" name="FromValue">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="Id" type="xs:string" />
              <xs:element name="Value" type="xs:string" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

样本输入文件

<ns0:Root xmlns:ns0="http://Scratch.SO53891801_input">
  <poNumber>poNumber_0</poNumber>
  <carrier>carrier_0</carrier>
  <trackingNumber>trackingNumber_0</trackingNumber>
  <shipDate>1999-05-31</shipDate>
</ns0:Root>

poNumber_0
载波0
跟踪编号\u 0
1999-05-31
示例输出模式

<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://Scratch.SO53891801_input" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns:ns0="http://Scratch.SO53891801propertyschema" targetNamespace="http://Scratch.SO53891801_input" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:annotation>
    <xs:appinfo>
      <b:imports>
        <b:namespace prefix="ns0" uri="http://Scratch.SO53891801propertyschema" location=".\SO53891801propertyschema.xsd" />
      </b:imports>
    </xs:appinfo>
  </xs:annotation>
  <xs:element name="Root">
    <xs:annotation>
      <xs:appinfo>
        <b:properties>
          <b:property name="ns0:poNumber" xpath="/*[local-name()='Root' and namespace-uri()='http://Scratch.SO53891801_input']/*[local-name()='poNumber' and namespace-uri()='']" />
        </b:properties>
      </xs:appinfo>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element name="poNumber" type="xs:string" />
        <xs:element name="carrier" type="xs:string" />
        <xs:element name="trackingNumber" type="xs:string" />
        <xs:element name="shipDate" type="xs:date" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://Scratch.SO53891801" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://Scratch.SO53891801" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="HttpRequestBody">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" name="FromValue">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="Id" type="xs:string" />
              <xs:element name="Value" type="xs:string" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

在两者之间创建一个映射

地图


消息中的上下文属性 从输入模式中,它将提升属性,并且在执行映射后该属性仍然存在

显示发送端口上的映射后仍存在上下文属性


那么poNumber是从哪里来的呢?这有点不清楚。你能给我们一个有效载荷的样本吗?e、 g.映射到HttpRequest主体之前的有效负载。不,我认为您还没有达到限制,您可能可以为poNumber定义一个仅限消息上下文的提升属性。请澄清一点。该API是(采购订单)的单个实例,因此您不应该从重复的采购订单编号开始。看来这才是真正的问题。嗨,约翰305。我的输入消息中没有重复的PO编号。我有一个值需要作为URL的一部分发送到客户端的API,但该值不能出现在消息正文中。感谢Dijkgraaf花时间回复这些有用的细节。我不知道上下文属性可以这样设置。然而,这并没有解决我的问题。该值确实正确地映射到所描述的URL,但是它也出现在消息体中,这是一个问题。当我把我的信息推出一条扁平的流水线时:例外:carrier=FEDEX&trackingNumber=4xxxxx&shipDate=2018-12-17……实际:111111111 carrier=FEDEX&trackingNumber=4xxxxx&shipDate=2018-12-17(111111111是订单号……应该只映射到URL,而不是消息)@DougGriffin然后您的地图中有一个问题,它创建了有效负载。您能否将地图的详细信息添加到问题和示例有效负载,以及输出(根据您的评论,所需的与实际的比较)?如果您查看我的映射,我没有将PO编号映射到输出消息。也可能是发送端口上的配置。