Serialising and Deserialising Requests and Responses exactly as WCF does
- by PeteAC
I need to deserialise SOAP request XML to .Net request object and to serialise .Net response object to SOAP response XML. I need this to work exactly as WCF does, using the same XML element local names and namespace URIs.
The .Net request and response classes were generated from WSDL using SVCUTIL.
I have looked at XmlSerializer class, which does most of it, but doesn't take notice of certain WCF-specific custom attributes, like MessageBodyMemberAttribute. I also looked at DataContractSerializer, but that had exceedingly strange ideas about what element names and namespaces to use. Finally, I tried XmlSerializer with an XmlTypeMapping generated by a SoapReflectionImporter; this didn't seem to use any namespaces at all.
I rather suspect that I need to be using one of the above techniques, but with some additional subtlety, of which I am unaware. But perhaps there is an entirely different approach?
All suggestions welcome.