You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

XML请求在线解析正常但计费服务器反序列化失败求助

SOAP端点XML请求反序列化异常求助

发送的XML请求

{<Policy xmlns="http://schemas.datacontract.org/2004/07/CompanyThatWroteBillingSoftware.BusinessObjects"><EffectiveDate>2023-01-25T00:00:00</EffectiveDate><ExpirationDate>2024-01-25T00:00:00</ExpirationDate><PaymentPlanId>2</PaymentPlanId><PolicyId>QC103986</PolicyId><PolicyStatus>Quote</PolicyStatus><SourceSystem>USERNAME</SourceSystem></Policy>}

该XML在所有在线XML解析器中均可成功解析,但发送至计费服务器时抛出如下异常:

服务器返回的异常

<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"><System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"><EventID>131075</EventID><Type>3</Type><SubType Name="Error">0</SubType><Level>2</Level><TimeCreated SystemTime="2023-01-17T15:47:07.4196570Z" /><Source Name="System.ServiceModel" /><Correlation ActivityID="{00000000-0000-0000-0000-000000000000}" /><Execution ProcessName="w3wp" ProcessID="18172" ThreadID="94" /><Channel/><Computer>SERVERNAME</Computer></System><ApplicationData><TraceData><DataItem><TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Error"><TraceIdentifier>http://msdn.microsoft.com/en-US/library/System.ServiceModel.Diagnostics.ThrowingException.aspx</TraceIdentifier><Description>Throwing an exception.</Description><AppDomain>/LM/W3SVC/2/ROOT/api-2-133184439071488997</AppDomain><Exception><ExceptionType>System.Runtime.Serialization.SerializationException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>Unable to deserialize XML body with root name 'Policy' and root namespace 'http://schemas.datacontract.org/2004/07/CompanyThatWroteBillingSoftware.BusinessObjects' (for operation 'ChangePaymentPlan' and contract ('Services',  'http://tempuri.org/')) using DataContractSerializer. Ensure that the type corresponding to the XML is added to the known types collection of the service.</Message><StackTrace>   at System.ServiceModel.Dispatcher.SingleBodyParameterMessageFormatter.ReadObject(Message message)

补充说明

  • 请求的Content-Type为application/xml,内容长度正确
  • 相同代码在其他机器上执行可正常运行,推测是数据或版本问题
  • 首次接触SOAP端点,恳请提供解决思路

内容的提问来源于stack exchange,提问作者awimley

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.03 19:45:32