473,503 Members | 2,238 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Serialization problem

Hi all.

Trying to serialize and desirialize an object. the object is transfered as a
byte[] using a web service to the client. the client then has to deserialize
the byte[] to an object and work with it.

the object has a not-so-complicated graph constructed from several classes i
made and fields of mostly simple types (string, int, enums) and bitmaps.

I am getting an error on the client side saying "Object type cannot be
converted to target type."

I was afraid that since some of the properties are defined only as "get",
the formatter cant reconstruct object state. to verify that, I added a line
in the web service that desirializes the object too, and that works. seems
like the "traffic on the web" (lol) has damaged the object?

both web service and client use the same dll that holds the classes and the
same version.

any ideas?

thanx,

picho
Nov 16 '05 #1
3 1331
In article <Og**************@TK2MSFTNGP09.phx.gbl>,
SP********@telhai.ac.il says...
Hi all.

Trying to serialize and desirialize an object. the object is transfered as a
byte[] using a web service to the client. the client then has to deserialize
the byte[] to an object and work with it.

the object has a not-so-complicated graph constructed from several classes i
made and fields of mostly simple types (string, int, enums) and bitmaps.

I am getting an error on the client side saying "Object type cannot be
converted to target type."

I was afraid that since some of the properties are defined only as "get",
the formatter cant reconstruct object state. to verify that, I added a line
in the web service that desirializes the object too, and that works. seems
like the "traffic on the web" (lol) has damaged the object?

both web service and client use the same dll that holds the classes and the
same version.


If both client and server will be running .NET, you'll probably get
better performance (and less problems) using remoting. The
serialization will done for you by the remoting framework. Your code
can be as simple as:

MyServerObject server = new MyServerObject();
server.Method1();
server.Method3(4, 3);

Yet "MyServerObject" is an object on a remote server.

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 16 '05 #2
Thank you Patrick for your reply.

I understand that remoting can work in tcp cahnnel as well?

how can I ensure security that is if the object state holds confidential
info.
what I did with the web service is serializing and then encrypting so I felt
it was a secure way.

"Patrick Steele [MVP]" <pa*****@mvps.org> wrote in message
news:MP************************@msnews.microsoft.c om...
In article <Og**************@TK2MSFTNGP09.phx.gbl>,
SP********@telhai.ac.il says...
Hi all.

Trying to serialize and desirialize an object. the object is transfered as a byte[] using a web service to the client. the client then has to deserialize the byte[] to an object and work with it.

the object has a not-so-complicated graph constructed from several classes i made and fields of mostly simple types (string, int, enums) and bitmaps.

I am getting an error on the client side saying "Object type cannot be
converted to target type."

I was afraid that since some of the properties are defined only as "get", the formatter cant reconstruct object state. to verify that, I added a line in the web service that desirializes the object too, and that works. seems like the "traffic on the web" (lol) has damaged the object?

both web service and client use the same dll that holds the classes and the same version.


If both client and server will be running .NET, you'll probably get
better performance (and less problems) using remoting. The
serialization will done for you by the remoting framework. Your code
can be as simple as:

MyServerObject server = new MyServerObject();
server.Method1();
server.Method3(4, 3);

Yet "MyServerObject" is an object on a remote server.

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele

Nov 16 '05 #3
In article <#t**************@TK2MSFTNGP09.phx.gbl>,
SP********@telhai.ac.il says...
Thank you Patrick for your reply.

I understand that remoting can work in tcp cahnnel as well?

how can I ensure security that is if the object state holds confidential
info.
what I did with the web service is serializing and then encrypting so I felt
it was a secure way.


See this MSDN article:

http://tinyurl.com/6zy5z

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 16 '05 #4

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

Similar topics

4
2083
by: David K | last post by:
we are having a problem when trying to serilalize and deserialize DataTable When replacing the container to be ListArray or HashTable everything works fine The code is very straight forward (...
37
4945
by: Ben | last post by:
Hi, there. Recently I was working on a problem where we want to save generic closures in a data structure (a vector). The closure should work for any data type and any method with pre-defined...
0
1217
by: ktn | last post by:
Hi all, I'm a .NET beginner and I've got a problem on a program where I try to do an XML serialization. I get the following error : "An unmanaged exception of type...
1
4349
by: andrewcw | last post by:
There is an error in XML document (1, 2). I used XML spy to create the XML and XSD. When I asked to have the XML validated it said it was OK. I used the .net SDK to generate the class. I have...
2
2341
by: ofer | last post by:
Hi, I am working with the beta version of the new .net framework (Whidbey) and I encountered a problem with serialization that did'nt exist in the .net 2003 the situation is like this : I have...
0
2478
by: umhlali | last post by:
I get the following exception when my VB.NET app calls a Java web service that returns an array of objects. The same call works for a single object though. So looks like there is no problem...
5
6006
by: Harold Howe | last post by:
I am having a problem deserializing objects from a library when the following conditions exist: 1- The library is strongly named 2- The serialized file was created with version 1.0 of the...
2
1609
by: Norman Chong | last post by:
Hiddeldi ho, I want to save an object so that I can use its content after I restart my program. I tried to solve this with serialization because someone told me that this is the correct way for...
4
11379
by: mijalko | last post by:
Hi, I have inherited my class from System.Drawing.Printing.PrintDocument and I wish to serialize this object using XmlSerializer. And I get exception "There was an error reflecting type ...". If I...
2
5533
by: mkvenkit.vc | last post by:
Hello, I hope this is the right place to post a question on Boost. If not, please let me know where I can post this message and I will do so. I am having a strange problem with std::string as...
0
7205
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,...
0
7093
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...
0
7353
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7468
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5023
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...
0
4689
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...
0
1521
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 ...
1
747
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
401
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.