开发者

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开发者_StackOverflow. 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?


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).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜