Fiddler is showing any exception from the server when there is an additional node in the xml which is not defined in the DataContract.
I am executing a PUT through fiddler. I am passing an additional node in my xml, i.e a DataMember is not defined in c# object, but after executing this i am not getting any exception.
Following is the request header and body for it, in the below example in Task is never defined but provided in the xml.
User-Agent: Fiddler
Content-length: 1306
Content-Type: application/xml
Authorization: admin:admin
Host: ***
Request Body
<Task xmlns="http://****" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<FirstName>abc</FirstName>
<xyz>test</xyz>
</Task>
C# Object
[DataContract(Namespace = "http://***")]
public class Task
{
[DataMember]
public string FirstName{ get; set; }
}
With the above scenario why doesn't the server throw any exception?
It would be your web server that you would expect to return an error code, not fiddler. It has been a couple years since I did WCF, but if I remember correctly, your additional xyz
field in the request will just be ignored by the DataContractSerializer
.