0
votes

I have created a WCF service in which one of the operation methods contains XElement as a parameter.I am getting an exception which is shown below

The IXmlSerializable type 'System.Xml.Linq.XElement' cannot be deserialized in partial trust because it does not have a public parameterless constructor

can we pass xelement to wcf , i mean to say as a parameter , if cannot then how to pass the xml document to wcf.

Thanks in advance

2

2 Answers

1
votes

Try using XmlElement instead of XElement, that should work on both full and partial trust (which seems to be your case).

0
votes

If you want to pass XML data as parameter, either use a String or if your XML has got a fixed structure, create appropriate (or generate) DataContract classes and use strongly typed parameter.