Serialising and Deserialising Requests and Responses exactly as WCF does
Posted
by
PeteAC
on Stack Overflow
See other posts from Stack Overflow
or by PeteAC
Published on 2010-12-21T11:08:37Z
Indexed on
2011/02/01
23:25 UTC
Read the original article
Hit count: 215
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.
© Stack Overflow or respective owner