title: Forcing ASMX proxy to use XmlSerializer instead of DataContractSerializer
body: <p>We were given external SOAP services that we have to consume in our project. All of these provide WSDL data, but a lot of them are not .NET services (most of them were written in Java). We have generated a number of client proxies with wsdl.exe tool. This tool does what it's supposed to do, it creates proxies for us to consume.</p>
  
  <p>The problem appears once we try to call methods on these services using generated proxies. We intercept all SOAP requests for logging purposes and XML data looks different from the one specified in WSDL schema. </p>
  
  <p>For instance, if a field is called "Name", our proxies will serialize it as "nameField". I guess this is because the property called "Name" uses a backing field called "nameField". Services on the other side obviously can't interpret this kind of naming convention.</p>
  
  <p>This wouldn't be happening if our ASMX proxies used the old XmlSerializer, but for some reason they opt for DataContractSerializer, which completely messes up serialization and breaks compatibility between clients and services.</p>
  
  <p>My colleagues have resorted to manually constructing XML data and then sending it with HttpWebRequest class. I think this is completely unacceptable in 2011, this is what automated proxy generation is for.</p>
  
  <p>My question is: why is this happening? Why are our proxies using DataContractSerializer and thus ignoring all xml serialization attributes in the process? Is there a way to force them to use XmlSerializer once again?</p>
  
  <p>We use .NET 4.0.</p>