C# web服务错误:XML文档中存在错误

C# web服务错误:XML文档中存在错误,c#,web-services,visual-studio-2012,wsdl,C#,Web Services,Visual Studio 2012,Wsdl,我收到了一个提供wsdl的web服务,当我在SoapUI中测试它时,它运行良好并返回数据,但是当我在Visual studio中将wsdl文件添加为web服务并测试它时,它抛出下面的错误。查看内部异常后,我们看到: System.FormatException: Input string was not in a correct format. at System.Number.StringToNumber(String str, NumberStyles options, Num

我收到了一个提供wsdl的web服务,当我在SoapUI中测试它时,它运行良好并返回数据,但是当我在Visual studio中将wsdl文件添加为web服务并测试它时,它抛出下面的错误。查看内部异常后,我们看到:

System.FormatException: Input string was not in a correct format.
       at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffe
    r& number, NumberFormatInfo info, Boolean parseDecimal)
在VisualStudio的reference.cs文件中,我看到company属性是Delcareed类型字符串,但它包含XmlElementAttribute,我认为它可以转换为整数


我将数据类型从string更改为integer,但仍然不起作用。 我无法调试代码,因为我的开发机器中只有wsdl文件,并且提供给我的web服务无法从客户端网络外部访问

我该怎么解决这个问题


来自Reference.cs的代码

[System.Xml.Serialization.XmlElementAttribute(DataType="integer")]
    public string Company {
        get {
            return this.companyField;
        }
        set {
            this.companyField = value;
        }
    }


响应数据的第一行:

<?xml version="1.0" encoding="UTF-8" standalone="no"?><n4:Envelope xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:n="http://www.informatica.com/wsdl/" xmlns:n4="http://schemas.xmlsoap.org/soap/envelope/" xmlns:n5="http://schemas.xmlsoap.org/wsdl/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><n4:Body><n:SHA003Bis_GetArticleDataResponse><n:SHA003Bis_GetArticleDataResponseElement><n:Articles><n:Article><n:MMITNO>L8035.145      </n:MMITNO><n:MMITDS>Print Saint-Tropez</n:MMITDS>
L8035.145打印圣特罗佩斯

上面的字符串长度为498个字符。第491个字符是冒号“:“此处

“我将数据类型从字符串更改为整数”如果它是字符串,为什么要这样做?失败的价值是什么?它是否真的意味着一个数字?我不确定失败的值是什么。如上所述,我无法调试代码。该方法的参数需要三个参数,其中一个参数在XSD中指定为
Integer
,但在Visual Studio中它是作为字符串类型创建的。根据内部异常,在从字符串到整数的转换过程中会抛出错误。您可以通过查看基于错误消息的XML来找出失败的地方-查看第一行的491字符…Jon,我在上面的帖子中添加了WSDL代码。但是
错误源
表明错误发生在
System.xml中
它不在WSDL中-它在读取的数据中(据我所知)。
<?xml version="1.0" encoding="UTF-8" standalone="no"?><n4:Envelope xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:n="http://www.informatica.com/wsdl/" xmlns:n4="http://schemas.xmlsoap.org/soap/envelope/" xmlns:n5="http://schemas.xmlsoap.org/wsdl/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><n4:Body><n:SHA003Bis_GetArticleDataResponse><n:SHA003Bis_GetArticleDataResponseElement><n:Articles><n:Article><n:MMITNO>L8035.145      </n:MMITNO><n:MMITDS>Print Saint-Tropez</n:MMITDS>