BizTalk错误:“ ...请确保您输入的XML符合操作的架构。”

时间:2019-10-17 09:48:57

标签: xml xsd biztalk biztalk-2013r2

最近在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 Server存储过程,其架构如下:

<?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 Server存储过程绑定的发送端口。

地图如下: 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>

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

1 个答案:

答案 0 :(得分:0)

所以错误看起来像在发送端口上,对吗?而且它抱怨TypedPollingResultSet0,听起来像是您接收位置的架构。因此,我怀疑您的消息未映射到最终架构。

还请确保检查是否在发送端口上提升了BTS.Operation的属性,或者将操作值直接放入action字段。

最后,您可以根据接收方和发送方的消息属性来跟踪消息并让我们知道实际情况。