我在 BizTalk 中遇到以下错误消息:
The adapter failed to transmit message going to send port "TIMESHEET_ODS_GMPS_FAB" with URL "mssql://SINGVSQLD8/VID08/GMPS?InboundId=CSP_BT_TIMESHEET_ODS_TO_GMPS". It will be retransmitted after the retry interval specified for this Send Port. Details:"Microsoft.ServiceModel.Channels.Common.XmlReaderParsingException: The start element with name "CSP_BT_TIMESHEET_ODS_TO_GMPS" and namespace "http://schemas.microsoft.com/Sql/2008/05/Procedures/dbo/GMPS" was unexpected. Please ensure that your input XML conforms to the schema for the operation.
我知道之前有几篇帖子的主题相同,但不幸的是没有一个适用,因为我尝试了以下尝试但没有结果:
- 验证运行时消息和模式之间的实例以确保 输入的 XML 符合模式
- 确保在整个过程中将消息设置为正确的消息类型 编排流程
- 使用一致的命名空间 http://schemas.microsoft.com/Sql/2008/05/Procedures/dbo/GMPS在里面 模式
- 在 SOAP 操作中使用操作名称“CSP_BT_TIMESHEET_ODS_TO_GMPS” 与发送端口操作标识符匹配并使用的 header 操作操作“Procedure/dbo/CSP_BT_TIMESHEET_ODS_TO_GMPS”到 与命名空间匹配
此外,还有其他一些可能相关或不相关的事情:
- 我尝试设置 Root Reference 属性
- 没有使用相同命名空间的架构
- 没有端口使用相同的 InboundID
- 我没有为这个特定的模式使用 XML 传输
我的运行时[但缩短]消息如下:
<?xml version="1.0" encoding="utf-8"?>
<CSP_BT_TIMESHEET_ODS_TO_GMPS xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/Sql/2008/05/Procedures/dbo/GMPS">
<p_request_xml><GMPS_FAB><record><fromdate>2014-02-01T00:00:00</fromdate><todate>2014-02-07T00:00:00</todate><empno>00157772</empno><legacyempnum>90297</legacyempnum><timesheet_date>2014-02-05T00:00:00</timesheet_date><paycode>AUST-NOR-SAL</paycode><spanid>63295458</spanid><contractnum>R3133</contractnum><company_code>0244</company_code><job_project>45985</job_project><subacct_costctr>CRPMT</subacct_costctr><ctr_opcode>CR001</ctr_opcode><wbs_code /><ll1worked>0244</ll1worked><ll2worked>0100</ll2worked><ll3worked>45985</ll3worked><ll4worked>CRPMT</ll4worked><ll6worked /><hoursamt>8.000000</hoursamt><acttrantype>O</acttrantype><billot>R</billot><billotrate>119.790000</billotrate><diff_rate /><diff_ot_rate>0.00000000000000</diff_ot_rate><direct_ind>D</direct_ind><emp_base_rate>119.790000</emp_base_rate><emp_ot_rate>0.000000000000</emp_ot_rate><interfaceflag /><vendorcode /><PAYRULE>AUST-STAFF-EXEC</PAYRULE><hourstype>REG</hourstype><emp_engage_type>N</emp_engage_type><contractor_ot_rate /><last_modified>2014-02-06T19:27:16.400</last_modified><process_date>2014-03-26T22:29:04.417</process_date><calendar_id>502</calendar_id><equip_depth /><equip_block /><equip_loc /><fullnm>Burry, Raymond W</fullnm><shiftcode>8</shiftcode><ll1home>0244</ll1home><ll2home>5000</ll2home><ll3home>52363</ll3home><craftcode /><exportflag /><job_discipline_code /><job_discipline_name>Project Engineer (Eng)</job_discipline_name><application_code>GMPS</application_code><application_name>GMPS</application_name><calgroup_name>GMPS APAC Engineering</calgroup_name><calgroup_desc>GMPS AP Engineering</calgroup_desc><location_code>SING</location_code><calendar_name>GMPS_GMPS APAC Engineering_02012014_02072014</calendar_name><date_last_extracted>2014-03-24T22:23:00</date_last_extracted></record></GMPS_FAB></p_request_xml>
<p_response_xml xsi:nil="true" />
</CSP_BT_TIMESHEET_ODS_TO_GMPS>
我的架构如下:
<?xml version="1.0" encoding="utf-16" ?>
<xs:schema xmlns="http://schemas.microsoft.com/Sql/2008/05/Procedures/dbo/GMPS" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns:ns3="http://schemas.datacontract.org/2004/07/System.Data/GMPS" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/Sql/2008/05/Procedures/dbo/GMPS" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import schemaLocation=".\DataSetSchema.xsd" namespace="http://schemas.datacontract.org/2004/07/System.Data/GMPS" />
<xs:annotation>
<xs:appinfo>
<fileNameHint xmlns="http://schemas.microsoft.com/servicemodel/adapters/metadata/xsd">Procedure.dbo</fileNameHint>
<b:references>
<b:reference targetNamespace="http://schemas.datacontract.org/2004/07/System.Data/GMPS" />
</b:references>
</xs:appinfo>
</xs:annotation>
<xs:element name="CSP_BT_TIMESHEET_ODS_TO_GMPS">
<xs:annotation>
<xs:documentation>
<doc:action xmlns:doc="http://schemas.microsoft.com/servicemodel/adapters/metadata/documentation">Procedure/dbo/CSP_BT_TIMESHEET_ODS_TO_GMPS</doc:action>
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" name="p_request_xml" nillable="true" type="xs:string" />
<xs:element minOccurs="0" maxOccurs="1" name="p_response_xml" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="CSP_BT_TIMESHEET_ODS_TO_GMPSResponse">
<xs:annotation>
<xs:documentation>
<doc:action xmlns:doc="http://schemas.microsoft.com/servicemodel/adapters/metadata/documentation">Procedure/dbo/CSP_BT_TIMESHEET_ODS_TO_GMPS/response</doc:action>
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" name="CSP_BT_TIMESHEET_ODS_TO_GMPSResult" nillable="true" type="ns3:ArrayOfDataSet" />
<xs:element minOccurs="1" maxOccurs="1" name="ReturnValue" type="xs:int" />
<xs:element minOccurs="0" maxOccurs="1" name="p_response_xml" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
我的 SOAP 操作 header 如下:
<BtsActionMapping xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Operation Name="CSP_BT_TIMESHEET_ODS_TO_GMPS" Action="Procedure/dbo/CSP_BT_TIMESHEET_ODS_TO_GMPS" />
</BtsActionMapping>
如果您遇到过类似的错误消息或看到我的代码有问题,将不胜感激。
最佳答案
问题现已解决。 不过后来又遇到了其他几个问题,包括超时问题,直到我终于完成了刚才的开发,即将晋升为QA。
长话短说,我收到了一条离线建议,提到我不应该修改一个架构,而只是查找并替换所有内容以用作其他架构,即使我进行了干净的查找和替换过程也是如此。 因此,我从头开始重新创建架构并重新部署,突然间一切正常。
另外,我用了http://schemas.microsoft.com/Sql/2008/05/Procedures/dbo命名空间,而不是新创建的模式中带有/GMPS 后缀的命名空间,因为它是给定的默认值。 除了 namespace 之外,新架构中的所有其他内容都与旧架构完全匹配 [至少从我的角度来看]。
但是,由于我的项目现在有点落后于计划,我没有尝试: [1] 仅更改命名空间而不从头开始重新创建模式 [2] 从头开始重新创建架构后尝试使用带有/GMPS 后缀的命名空间
此帖仅供日后引用。
关于xml - BizTalk::名称为 "X"且命名空间为 "Y"的开始元素是意外的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25187225/