DataContract question: Support for returning XmlDocument to client
-
Wednesday, March 08, 2006 11:42 PM
Hi,
I have a service method which returns xml document to client. If I have this method, then service is returning error:
"The service encountered an error while generating metadata. See the trace files for more details."
My code is:
[
ServiceContract] public interface IMyService{
[OperationContract]
MyXmlData GetInstructionSumaryXmlDoc();}
[
DataContract] public class MyXmlData{
[
DataMember]public
XmlDocument Data;}
Is there any thing wrong in the above code?
Thanks in Advance,
Venkat
All Replies
-
Thursday, March 09, 2006 7:07 PM
You will need to add the [XmlSerializerFormat] attribute.
So (without using Datacontract although you can use that too):
[
ServiceContract(Namespace = "urn:SerializationTest")][
XmlSerializerFormat] public interface IBlah{
[OperationContract] XmlDocument Returnxmldoc();}
-
Friday, March 21, 2008 8:57 PM
Thanks! I had the same problem and have been banging my head on the keyboard all day, but that fixed it!

