Instance validation error: '2' is not a valid value for QueryType. (web service)

Posted by Anthony Shaw on Stack Overflow See other posts from Stack Overflow or by Anthony Shaw
Published on 2009-09-15T20:31:21Z Indexed on 2010/03/30 17:13 UTC
Read the original article Hit count: 595

Filed under:
|
|
|

I have a web service that I am passing an enum

public enum QueryType {
    Inquiry = 1
    Maintainence = 2
}

When I pass an object that has a Parameter of QueryType on it, I get the error back from the web service saying that '2' is not a valid value for QueryType, when you can clearly see from the declaration of the enum that it is.

I cannot change the values of the enum because legacy applications use the values, but I would rather not have to insert a "default" value just to push the index of the enum to make it work with my web service. It acts like the web service is using the index of the values rather than the values themselves.

Does anybody have a suggestion of what I can do to make it work, is there something I can change in my WSDL?

© Stack Overflow or respective owner

Related posts about web-services

Related posts about c#