开发者

WCF XmlNode : Can't serialize

开发者 https://www.devze.com 2023-04-11 00:12 出处:网络
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. I

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

精彩评论

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

关注公众号