whyvez
whyvez

Reputation: 75

WCF XmlNode : Can't serialize

I am rewriting a legacy asp.net web service (.asmx) in WCF. The legacy service exposed a method argument of type XmlNode. Seems like in WCF the XmlNode type cannot be serialized. If i try to change the arg to a string on the service side the consumer (.net class library service host wrapper) which is expecting XmlNode complains and does not execute successfully. I cannot change the service host. Any insight?

Upvotes: 0

Views: 1278

Answers (1)

carlosfigueira
carlosfigueira

Reputation: 87293

You can replace it with XmlElement or XElement. ASMX services could return XmlNode, but not all subclasses of it were supported - for example, if you tried to return a XmlAttribute, it would fail. If you're already returning XmlElement, then you're fine; if you're returning a XmlDocument, then you can change it to return the DocumentElement its property (which is a XmlElement).

Upvotes: 1

Related Questions