I have a WCF web service that worked fine. Somewhere along the line it stopped, and I cannot understand why. The code and interface never changed or made web.config (at least not with respect to the web services section). I have a class:
[DataContract] public class QuizServiceArgs { [DataMember(IsRequired = true, Order = 1)] public int Category1 { get; set; } [DataMember(IsRequired = true, Order = 2)] public int Category2 { get; set; } [DataMember(IsRequired = true, Order = 3)] public int Category3 { get; set; } [DataMember(IsRequired = true, Order = 4)] public int Category4 { get; set; } }
And the service interface is simple:
public interface IQuizService { [OperationContract] [WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.WrappedRequest, ResponseFormat = WebMessageFormat.Json)] ServiceResult Save(QuizServiceArgs answers, string strvalue, int intvalue); }
The second two parameters strvalue and intvalue were added only for troubleshooting, to make sure they get deserialized - and they are. When I got into the service, I get an error saying that I am missing the Category1 parameter from the request, but, as you can see this Fiddler screenshot, there are values.

I can get primitive values, but the objects seem to all be created with null values ββor default values. What am I doing wrong?
UPDATE
In fact, I did not have an answer to my original question, which sucks, but Sixto suggested switching my serialization to JSON. JSON was the original design, but was muffled when I had problems with it. After I successfully switched to JSON, everything was correctly serialized and deserialized. Now I just wait for this to break without explanation, so I can return to XML ....
Jeff
source share