This is a discussion on Error in webservice within the C# Programming forums, part of the Software Development category; Hi, I am using webservice.I am overcoming an error in the webservice and the error is "Cannot serialize ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| Hi, I am using webservice.I am overcoming an error in the webservice and the error is "Cannot serialize member System.ComponentModel.Component.Site of type System.ComponentModel.ISite because it is an interface" .Can anyone tell me why this error comes?
__________________ Sathish Kumar.R ![]() Knowledge is meant to SHARE |
| Sponsored Links |
| |||
| The XmlSerializer errors when serializing an object with a public property of type IList<T>. Since IList<T> is an ICollection, this should work. Also, it similarly errors when using properties that are of any interface type that inherits from IList<T>. Making that interface explicitly implement IEnumerable doesn't work either (even though the documentation implies that this should work).
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| |||
| Hi there, Natasha Jethanandani Xml Messaging team from microsoft gave a comment about this... She says ..... The issue occurs since IList<T> does not implement ICollection and the XmlSerializer does not support interface members other than ICollection and IXmlSerializable. Microsoft fixing this in a future release. A work-around for this issue would be to use the fully typed list type as a member type instead of interface.
__________________ cheers Aman |
| |||
| Hey, I have found the solution.The issue is when we return something from the webservice,we must specify proper annotation for each and every properties described inside the serializable class. For example, [XmlAttribute] when it is a basic datatypes such as string or integer etc, [XmlArray(property name),XmlArrayitem(arrayType)] for array Or else,we will get this error anyway ..
__________________ Sathish Kumar.R ![]() Knowledge is meant to SHARE |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Overcoming an error in the Webservice | Sathish Kumar | C# Programming | 5 | 09-30-2008 04:53 AM |
| Webservice and its uses | poornima | ASP and ASP.NET Programming | 7 | 03-20-2008 09:49 PM |
| why the "InvalidOperationException" error when returning array value in webservice? | leoraja8 | ASP and ASP.NET Programming | 7 | 11-14-2007 10:39 PM |
| ASP.net 2.0 Webservice and WCF | kingmaker | ASP and ASP.NET Programming | 1 | 10-11-2007 04:15 AM |
| note on webservice | nssukumar | Java Programming | 1 | 03-12-2007 05:05 AM |