473,624 Members | 2,444 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Serialize Person Object

I am writeing a webService that needs to recieve a CDO.Person object as a
parameter. but when I run it I have a runtime error.

Cannot serialize member CDO.PersonClass .DataSource of type CDO.IDataSource
because it is an interface

I assume that something is wrong with the serialization of this object.
Does anyone have experience in this subject?

thanks
Rob.-
Nov 16 '05 #1
1 2106
"Roberto Carriquiry" <al*****@micros oft.com> wrote in news:#j4QCAVIEH A.2596
@TK2MSFTNGP10.p hx.gbl:
I am writeing a webService that needs to recieve a CDO.Person object as a
parameter. but when I run it I have a runtime error.

Cannot serialize member CDO.PersonClass .DataSource of type CDO.IDataSource
because it is an interface

I assume that something is wrong with the serialization of this object.
Does anyone have experience in this subject?


The error is caused by the fact that the XmlSerializer can't deal
with Interface typed member variables. A webservice ALWAYS uses
XmlSerializer. You have to build the XML yourself and return that, or, if
CDO.Person is serializable using Soap, serialize it to string via a
MemoryStream and return that string, then on the client, deserialize the
object back from the string received.

Frans.

--
Get LLBLGen Pro, the new O/R mapper for .NET: http://www.llblgen.com
My .NET Blog: http://weblogs.asp.net/fbouma
Microsoft C# MVP
Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2662
by: James Sleeman | last post by:
Hi all, i just spent an hour rifling through code to find the cause of a problem only to find it's an oddity with serialization and recursive objects, so figured I'd post for the next person who gets the same problem (y'all might find it interesting too)... ********************************* Symptoms ********************************* When unserializing a previously serialized object, the __wakeup() function is mysteriously called more...
1
2036
by: Iyer, Prasad C | last post by:
Hi, I got a class which I need to serialize, except for couple of variable. i.e. import cPickle as p class Color: def __init__(self): print "hello world" self.x=10 self.somechar="this are the characters"
3
52262
by: Kristian Kjems | last post by:
This is the example from MSDN where an object is serialized to a filestream: MySerializableClass myObject = new MySerializableClass(); // Insert code to set properties and fields of the object. XmlSerializer mySerializer = new XmlSerializer(typeof(MySerializableClass)); // To write to a file, create a StreamWriter object. StreamWriter myWriter = new StreamWriter("myFileName.xml"); mySerializer.Serialize(myWriter, myObject);
5
24695
by: David Sworder | last post by:
Hi, I've created a UserControl-derived class called MyUserControl that is able to persist and subsequently reload its state. It exposes two methods as follows: public void Serialize(Stream s); public void Deserialize(Stream s); Within the MyUserControl class, there is a field of type MyInnerClass
5
2134
by: Arjen | last post by:
Hello, I have an array "aPeople" with people objects which I serialize like this: XmlSerializer x = new XmlSerializer( typeof(People) ); TextWriter writer = new StreamWriter( "data.xml" ); x.Serialize( writer, aPeople ); Now I have also an array "aAnimal" with animal objects. Is there a way to put this in the same data.xml file?
0
1071
by: Arjen | last post by:
Hello, I have made a little test application and needs some help. I have two classes with hash tables which I want to serialize inside one xml file. My question is if someone can make the code complete? (loading and saving) - I have made some starting points. - The // comment tags says where to do "something". - What the "something" means I don't know... but I have tried...
1
298
by: Roberto Carriquiry | last post by:
I am writeing a webService that needs to recieve a CDO.Person object as a parameter. but when I run it I have a runtime error. Cannot serialize member CDO.PersonClass.DataSource of type CDO.IDataSource because it is an interface I assume that something is wrong with the serialization of this object. Does anyone have experience in this subject? thanks
4
5449
by: surindersaini | last post by:
Hi I am not sure if we can do it and if can, then how. I have a class with a property that return object as its return type. when i am trying to Serialize the class it gives me error **************************************************************** An unhandled exception of type 'System.InvalidOperationException' occurred in system.xml.dll Additional information: There was an error generating the XML document.
6
3049
by: Demetri | last post by:
I have a class that I need to serialize. For example if I had a Person class with the properties of FirstName and LastName. Currently when I serialize the class it looks like this: <?xml version="1.0" encoding="utf-8"?> <Person> <FirstName>John</FirstName> <LastName>Doe</LastName> </Person>
0
8231
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8168
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8330
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7153
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6107
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5561
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4075
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4167
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2603
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.