开发者

Serialising and Deserialising Requests and Responses exactly as WCF does

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 an开发者_运维问答d 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.


I'm puzzled by why you want to do this. Can you clarify?

Take a look at the implementation of DataContractSerializerOperationFormatter and DataContractSerializerOperationBehavior via Reflector. It captures how the message formatters and serializers interoperate within WCF...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜