Can data contract serialization be used with BasicHttpBinding?

688 Views Asked by At

If I want to write a web service and expose it as both WCF and basic SOAP, can my data types use only data contract serialization or do I have to use the XmlSerializer?

Microsoft mentions that the XmlSerializer is required

When creating services that follow the legacy SOAP Encoding standard

which may imply this.

Is there a standard technique for creating data types that can be exposed through all bindings?

2

There are 2 best solutions below

0
On BEST ANSWER

You can completely ignore the old XML Serializer if you are creating a new service. Just use Data Contract Serialization and the binding will take care of the rest.

0
On

I believe you could decorate your types with both data and xml serialization attributes. They will both be applied depending on the context.