开发者

WebService Problem Enum Value is not valid

Hi I am having a problem with a c# WebService, it was working fine but suddenly it stopped working, I am getting this error:

Unhandled Exception: System.InvalidOperationException: There is an error in XML document System.InvalidOperationException: 'Big' is not a valid value for Sources

Sources is an enum, so I went to my wsdl an it was this way:

 < s:simpleType name="Sources">

        <s:restriction base="s:string">
          s:enumeration value="Invalid" />
          <s:enumeration value="Any" />
          <s:enumeration value="RM" />
          <s:enumeration value="RV" />
          <s:enumeration value="RD" />
          <s:enumeration value="LV" />
        </s:restriction>
      </s:simpleType>

I could see it didn't have the 'Big' value, so I click on the WebService reference and then Update WebReference, then I went to the wsdl again and now I could see the 'Big' value

< s:simpleType name="Sources">

        <s:restriction base="s:string">
          <s:enumeration value="Invalid" />
          <s:enumeration value="Any" />
          <s:enumeration value="RM" />
          <s:enumeration value="RV" />
          <s:enumeration value="RD" />
          <s:enumeration value="LV" />
          <s:enumeration value="Big" />       <--------- This one was added
        </s:restriction>
      </s:simpleType>

However when I ran it again I got same error.

Unhandled Exception: System.InvalidOperationException: There is an error in XML document System.InvalidOperationException: 'Big' is not a valid value for Sources

How could I fix this? Seems updating webservice reference was not enough. Am I missing something?

Thanks in advance.

Albert

--Update

I have added this in order to be able to step into the deserializer

?xml version="1.0" encoding="utf-8" ?> configuration> system.diagnostics> switches> add name="XmlSerialization.Compilation" value="4" /> /switches> /system.diagnostics> /configuration>

reference: http://msdn.microsoft.com/en-us/library/aa302290.aspx

This is what I found

global:开发者_开发技巧:ReVal.Service.BE.WebService.Sources Read1_Sources(string s) { switch (s) { case @"Invalid": return global::ReVal.Service.BE.WebService.Sources.@Invalid; case @"Any": return global::ReVal.Service.BE.WebService.Sources.@Any; case @"RM": return global::ReVal.Service.BE.WebService.Sources.@RM; case @"RV": return global::ReVal.Service.BE.WebService.Sources.@RV; case @"RD": return global::ReVal.Service.BE.WebService.Sources.@RD; case @"LV": return global::ReVal.Service.BE.WebService.Sources.@LV; default: throw CreateUnknownConstantException(s, typeof(global::ReVal.Service.BE.WebService.Sources)); } }

Big value is not in the XMLSerializationReader of the webservice.


  s:enumeration value="Invalid" />

is missing a part:

 <s:enumeration value="Invalid" /> 

is that just a typo? and is the space in

< s:simpleType name="Sources">

at the "< s" an issue?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜