BizTalk Error: "...Please ensure that your input XML conforms to the schema for the operation."

BizTalk Error: "...Please ensure that your input XML conforms to the schema for the operation."

最近在 BizTalk 中出现了以下错误,我自己对错误进行故障排除并不满意:

The start element with name "TypedPollingResultSet0" and namespace "http://schemas.microsoft.com/Sql/2008/05/TypedPolling/BadgeMaker" was unexpected. Please ensure that your input XML conforms to the schema for the operation.

导致错误的消息没有编排,仅在端口上完成。接收端口轮询一个SQL服务器存储过程,schema如下:

<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns:tns="http://schemas.microsoft.com/Sql/2008/05/TypedPolling/BadgeMaker" xmlns:ns0="https://BadgeMaker.bagemaker_properties" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/Sql/2008/05/TypedPolling/BadgeMaker" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:annotation>
    <xs:appinfo>
      <fileNameHint xmlns="http://schemas.microsoft.com/servicemodel/adapters/metadata/xsd">TypedPolling.BadgeMaker</fileNameHint>
      <schemaInfo is_envelope="yes" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
      <b:imports>
        <b:namespace prefix="ns0" uri="https://BadgeMaker.bagemaker_properties" location=".\bagemaker_properties.xsd" />
      </b:imports>
    </xs:appinfo>
  </xs:annotation>
  <xs:complexType name="TypedPollingResultSet0">
    <xs:sequence>
      <xs:element minOccurs="0" maxOccurs="1" name="ID" nillable="true" type="xs:string" />
      <xs:element minOccurs="0" maxOccurs="1" name="Type" nillable="true" type="xs:string" />
      <xs:element minOccurs="0" maxOccurs="1" name="MiFare" nillable="true" type="xs:string" />
      <xs:element minOccurs="0" maxOccurs="1" name="Expiry" nillable="true" type="xs:dateTime" />
      <xs:element minOccurs="0" maxOccurs="1" name="Student_id" nillable="true" type="xs:string" />
    </xs:sequence>
  </xs:complexType>
  <xs:element name="TypedPollingResultSet0" nillable="true" type="tns:TypedPollingResultSet0">
    <xs:annotation>
      <xs:appinfo>
        <b:properties>
          <b:property name="ns0:PersonID" xpath="/*[local-name()='TypedPollingResultSet0' and namespace-uri()='http://schemas.microsoft.com/Sql/2008/05/TypedPolling/BadgeMaker']/*[local-name()='ID' and namespace-uri()='http://schemas.microsoft.com/Sql/2008/05/TypedPolling/BadgeMaker']" />
        </b:properties>
      </xs:appinfo>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="ArrayOfTypedPollingResultSet0">
    <xs:sequence>
      <xs:element minOccurs="0" maxOccurs="unbounded" name="TypedPollingResultSet0" type="tns:TypedPollingResultSet0" />
    </xs:sequence>
  </xs:complexType>
  <xs:element name="ArrayOfTypedPollingResultSet0" nillable="true" type="tns:ArrayOfTypedPollingResultSet0" />
  <xs:element name="TypedPolling">
    <xs:annotation>
      <xs:documentation>
        <doc:action xmlns:doc="http://schemas.microsoft.com/servicemodel/adapters/metadata/documentation">TypedPolling</doc:action>
        <doc:description xmlns:doc="http://schemas.microsoft.com/servicemodel/adapters/metadata/documentation">exec MiFareNotification</doc:description>
      </xs:documentation>
      <xs:appinfo>
        <recordInfo body_xpath="/*[local-name()='TypedPolling' and namespace-uri()='http://schemas.microsoft.com/Sql/2008/05/TypedPolling/BadgeMaker']/*[local-name()='TypedPollingResultSet0' and namespace-uri()='http://schemas.microsoft.com/Sql/2008/05/TypedPolling/BadgeMaker']" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
      </xs:appinfo>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" maxOccurs="1" name="TypedPollingResultSet0" nillable="true" type="tns:ArrayOfTypedPollingResultSet0" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

本架构导入的"bagemaker"架构如下:

<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://BadgeMaker.bagemaker_properties" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="https://BadgeMaker.bagemaker_properties" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:annotation>
    <xs:appinfo>
      <b:schemaInfo schema_type="property" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" />
    </xs:appinfo>
  </xs:annotation>
  <xs:element name="lost_card_type" type="xs:string">
    <xs:annotation>
      <xs:appinfo>
        <b:fieldInfo propertyGuid="bc02fae8-bcf7-4223-b78f-85d77f7153ac" />
      </xs:appinfo>
    </xs:annotation>
  </xs:element>
  <xs:element name="PersonID" type="xs:string">
    <xs:annotation>
      <xs:appinfo>
        <b:fieldInfo propertyGuid="facb4c50-c234-4824-bd05-be27aaa35ef7" />
      </xs:appinfo>
    </xs:annotation>
  </xs:element>
</xs:schema>

然后将其映射到绑定到另一个 SQL 服务器存储过程的发送端口。

地图如下: https://imgur.com/a/Wdn2yvy

发送到存储过程的架构如下:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:tns="http://schemas.microsoft.com/Sql/2008/05/TypedProcedures/dbo" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/Sql/2008/05/TypedProcedures/dbo" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:annotation>
    <xs:appinfo>
      <fileNameHint xmlns="http://schemas.microsoft.com/servicemodel/adapters/metadata/xsd">TypedProcedure.dbo</fileNameHint>
    </xs:appinfo>
  </xs:annotation>
  <xs:element name="sp">
    <xs:annotation>
      <xs:documentation>
        <doc:action xmlns:doc="http://schemas.microsoft.com/servicemodel/adapters/metadata/documentation">TypedProcedure/dbo/sp</doc:action>
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" maxOccurs="1" name="ID" nillable="true" type="xs:string" />
        <xs:element minOccurs="0" maxOccurs="1" name="Type" nillable="true" type="xs:string" />
        <xs:element minOccurs="0" maxOccurs="1" name="Mifare" nillable="true" type="xs:string" />
        <xs:element minOccurs="0" maxOccurs="1" name="Expiry" nillable="true" type="xs:dateTime" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="sp">
    <xs:annotation>
      <xs:documentation>
        <doc:action xmlns:doc="http://schemas.microsoft.com/servicemodel/adapters/metadata/documentation">TypedProcedure/dbo/sp/response</doc:action>
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="1" maxOccurs="1" name="ReturnValue" type="xs:int" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

我看不出端口、存储过程或模式本身有任何问题;一切似乎都适合我。如果我遗漏了任何信息,请告诉我。我检查了现有的类似问题和论坛帖子,但没有发现任何突出的适用问题。

所以错误看起来像是在发送端口上,对吗?它抱怨 TypedPollingResultSet0,这听起来像是来自您接收位置的模式。所以我怀疑你的消息没有被映射到你的最终模式。

还要确保检查是否 属性 在发送端口上提升 BTS.Operation,或者作为替代方案,将操作值直接放入操作字段。

最后,您可以跟踪您的消息,并根据接收方和发送方的消息属性让我们知道真正发生了什么。