The following error has been occurring recently in BizTalk and I have had no joy in troubleshooting the error myself:
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.
The message that is causing the error has no orchestration and is solely done on ports. The receive port polls a SQL Server stored procedure and the schema is as follows:
<?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>
The "bagemaker" schema imported in this schema is as follows:
<?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>
This is then mapped to a send port which is bound to another SQL Server stored procedure.
The map is as follows: https://i.sstatic.net/gsGKA.jpg
The schema for sending to the stored procedure is as follows:
<?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>
I can't see any issue with the ports, the stored procedures or the schemas themselves; everything seems to match up to me. If I've missed any information out then please let me know. I have checked existing similar questions and forum posts but haven't found anything that stands out as applicable.
So the error looks like on the send port, correct? And it complaints about a TypedPollingResultSet0, that sounds like the schema from your receive location. So my suspicion is that your message is not being mapped to your final schema.
Also make sure you check if you property promote the BTS.Operation on your send port, or as an alternative, place the operation value directly into the action field.
Finally, you can track your messages and let us know what really is going on based on the message properties at the receive and send side.