xml如下:

System.InvalidOperationException : 不应有 <Response xmlns=''>。
<?xml version="1.0" encoding="UTF-8"?>
<Response version="2">
  <datacash_reference>4700203048783633</datacash_reference>
  <information>Failed to identify the card scheme of the supplied card number</information>
  <merchantreference>1000001</merchantreference>
  <mode>TEST</mode>
  <reason>Invalid card type</reason>
  <status>21</status>
  <time>1382512427</time>
</Response>
System.InvalidOperationException : 不应有 <Response xmlns=''>。

原来的Entity如下:

    [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
    [Serializable()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [XmlType(AnonymousType = true)]
    [XmlRoot(Namespace = "", IsNullable = false)]

解决方案需要增加ElementName = "Response",如下:

    [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
    [Serializable()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [XmlType(AnonymousType = true)]
    [XmlRoot(Namespace = "", IsNullable = false, ElementName = "Response")]

Done!

 
C#

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-28
  • 2022-12-23
  • 2022-01-22
  • 2022-12-23
  • 2021-10-14
猜你喜欢
  • 2022-12-23
  • 2021-08-10
  • 2022-02-21
  • 2021-07-06
  • 2022-01-07
相关资源
相似解决方案