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
).
精彩评论