I'd like to use WCF to set up a cross-plattform WebService. A problem - actually more a performance issue - is that I'd like to return a Type (let's say Event) and I have this event already in XML. So I'd like to avoid deserializing to Event and then WCF is serializing it back to XML. Any idea how to manage this? What I want to achieve is something like "WCF, this method returns an Event-object but I've already serilized it to XML so take it and don't force me to deserialize it first so you can serialize it again".
Daniel
The WCF component that does message (de)serialization is the MessageFormatter
.
Hence, you could provide a custom IDispatchMessageFormatter
. In the SeralizeReply()
method (which returns a Message
) you could use the Message.CreateMessage()
overload that takes an XmlReader
and supply an XmlReader that you create from your XML. And that's it. A bit of work to do, though. You need to decide whether it's worth it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With