zoukankan      html  css  js  c++  java
  • System.InvalidOperationException : 不应有 <Response xmlns=''>。

    xml如下:

    <?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>

    原来的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!

  • 相关阅读:
    pip install MySQL-python 失败
    E: Unable to correct problems, you have held broken packages
    git 提交顺序
    git 分支
    ubuntu 安装git
    ubuntu 有些软件中不能输入中文
    ubuntu 完全卸载mysql
    Linux中常用操作命令
    基于注解的Spring AOP的配置和使用
    log4j配置详解
  • 原文地址:https://www.cnblogs.com/vincentDr/p/3384278.html
Copyright © 2011-2022 走看看