IT Community - Software Programming, Web Development and Technical Support

Error in webservice

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 ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > C# Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 09-04-2007, 01:12 PM
Sathish Kumar Sathish Kumar is offline
D-Web Analyst
 
Join Date: Feb 2007
Posts: 304
Sathish Kumar is on a distinguished road
Exclamation Error in webservice

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
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 09-05-2007, 12:00 AM
mobilegeek mobilegeek is offline
D-Web Analyst
 
Join Date: Jun 2007
Posts: 205
mobilegeek is on a distinguished road
Question Re: Error in webservice

Hi Sathish....

I'm also having that same problem....

But I'm using IDictionary as a type.

Could anybody pls help...
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 09-05-2007, 08:00 AM
Sathish Kumar Sathish Kumar is offline
D-Web Analyst
 
Join Date: Feb 2007
Posts: 304
Sathish Kumar is on a distinguished road
Exclamation Re: Error in webservice

Hi,
Are you returning something from the webservice?
__________________
Sathish Kumar.R
Knowledge is meant to SHARE
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 09-13-2007, 06:19 AM
Sathish Kumar Sathish Kumar is offline
D-Web Analyst
 
Join Date: Feb 2007
Posts: 304
Sathish Kumar is on a distinguished road
Exclamation Re: Error in webservice

Hey,
R u returning a class or something created by you from the webservice ?
__________________
Sathish Kumar.R
Knowledge is meant to SHARE
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 09-19-2007, 07:29 AM
mobilegeek mobilegeek is offline
D-Web Analyst
 
Join Date: Jun 2007
Posts: 205
mobilegeek is on a distinguished road
Talking Re: Error in webservice

Yes Sathish!

I found the solution for my problem at here.....please go to last Q & A.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 09-19-2007, 07:37 AM
S.Vinothkumar S.Vinothkumar is offline
D-Web Genius
 
Join Date: May 2007
Posts: 1,061
S.Vinothkumar is on a distinguished road
Smile Re: Error in webservice

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!
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 09-19-2007, 07:58 AM
amansundar amansundar is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 325
amansundar is on a distinguished road
Default Re: Error in webservice

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
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 09-20-2007, 04:55 AM
Sathish Kumar Sathish Kumar is offline
D-Web Analyst
 
Join Date: Feb 2007
Posts: 304
Sathish Kumar is on a distinguished road
Thumbs up Re: Error in webservice

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
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


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


All times are GMT -7. The time now is 11:35 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0