Will Custode
Will Custode

Reputation: 4594

Use XmlSerializer Instead of DataContractSerializer

So I have a web service that is configured using a webHttpBinding and a webHttp endpoint behavior. I want WCF to use the XmlSerializer instead of the DataContractSerializer, so I tried putting the XmlSerializerFormat attribute on my service class. When I do this I start getting a 400 response. Everything works when I do not have the XmlSerializerFormat on my service.

How can I make my WCF service that uses a webHttp binding and behavior use the XmlSerializer instead of the DataContractSerializer with minimal code changes?

If you need additional information about my implementation please comment and I will provide details. Thanks!

Upvotes: 1

Views: 1090

Answers (1)

Will Custode
Will Custode

Reputation: 4594

The solution to this issue turned out to be that there is a schema difference between the Xml generated by DataContractSerializer and XmlSerializer and because the client was still sending the Xml string generated by DataContractSerializer it was not being accepted during the conversion.

Upvotes: 1

Related Questions