Last post Oct 22, 2014 04:27 AM by May Wang
Oct 21, 2014 12:31 PM|Martin0|LINK
I've got an enum declared like so:
public enum MyEnum
The numeric values are stored in a database.
My problem is that on the client side (proxy auto generated code) the enum no longer has the non-default values assigned. Therefore it effectively becomes:
But the value that actually travels across the http wire is the numeric! So all the values become misinterpreted(!!!!)
I need the database to record numeric, and either the proxy code to retain the non-default values, or for the http to pass the labels instead of the values.
Any tips much appreciated.
Oct 21, 2014 01:28 PM|Martin0|LINK
I am surprised to see the values going the http wire as numeric values, when the wsdl declares them as with a type like this:
<s:enumeration value="Black" />
<s:enumeration value="Red" />
<s:enumeration value="Green" />
<s:enumeration value="Blue" />
To my mind the only valid values to go over the wire are the literals Black, Red, Green and Blue. Anything else should fail xml validation. It appears the XML is not validated against the auto generated schema in the wsdl???
PS I am using .Net 2.0 and asmx
Oct 22, 2014 03:52 AM|Martin0|LINK
Solved - somewhere deep in the code there were properties that were declared as int rather than the enum (Doh!! & ouch)
Oct 22, 2014 04:27 AM|May Wang|LINK
Thanks for sharing your solution.