473,385 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Problem with serialization

Hello. I'm getting a serialization error with the following.

I'm doing an app that works with a webservice. The app and the WS has to
work with a class that I made as a DLL; I have some web methods that
receives objects from this class as parameters. Although it compiles, when I
try to add the web reference to the application, I get an error:
"Library.Class cannot be serialized because it does not have a default
public constructor. "

The class has a constructor where I set the attributes, and it's the only
constructor.

Can you please help me?

Regards,

Diego F.
Nov 16 '05 #1
3 1417
All serializable classes have to have a default constructor ie. a
constructor with no parameters. So you need to have a constructor with no
parameters, and your class has to have Serializable attribute. like

[Serializable] // the attrbute
public class Test
{
public Test() // default contructor
{
...
}
}

Fitim Skenderi

"Diego F." <di*****@NOterra.es> wrote in message
news:ed**************@TK2MSFTNGP10.phx.gbl...
Hello. I'm getting a serialization error with the following.

I'm doing an app that works with a webservice. The app and the WS has to
work with a class that I made as a DLL; I have some web methods that
receives objects from this class as parameters. Although it compiles, when I try to add the web reference to the application, I get an error:
"Library.Class cannot be serialized because it does not have a default
public constructor. "

The class has a constructor where I set the attributes, and it's the only
constructor.

Can you please help me?

Regards,

Diego F.

Nov 16 '05 #2
Thank you for your answer. Now I can compile add the web reference, but I
have another problem :-/ When I'm compiling the application, I get an error
when calling a web method that has an object as a parameter. It expect to
receive an object from the web service type, but I'm passing the object from
my class, as it's the object that must receive.

Why do I have this error?

Regards,

Diego F.
"Fitim Skenderi" <fi****@hotmail.com> escribió en el mensaje
news:uO**************@TK2MSFTNGP11.phx.gbl...
All serializable classes have to have a default constructor ie. a
constructor with no parameters. So you need to have a constructor with no
parameters, and your class has to have Serializable attribute. like

[Serializable] // the attrbute
public class Test
{
public Test() // default contructor
{
...
}
}

Fitim Skenderi

"Diego F." <di*****@NOterra.es> wrote in message
news:ed**************@TK2MSFTNGP10.phx.gbl...
Hello. I'm getting a serialization error with the following.

I'm doing an app that works with a webservice. The app and the WS has to
work with a class that I made as a DLL; I have some web methods that
receives objects from this class as parameters. Although it compiles, when
I
try to add the web reference to the application, I get an error:
"Library.Class cannot be serialized because it does not have a default
public constructor. "

The class has a constructor where I set the attributes, and it's the

only constructor.

Can you please help me?

Regards,

Diego F.


Nov 16 '05 #3
Its a problem with your serialization most likely. Try peeking into the
References.cs file and see if you see another type in the definition
that looks exactly like your serializable object, thats most likely the
culprit

Diego F. wrote:
Thank you for your answer. Now I can compile add the web reference, but I
have another problem :-/ When I'm compiling the application, I get an error
when calling a web method that has an object as a parameter. It expect to
receive an object from the web service type, but I'm passing the object from
my class, as it's the object that must receive.

Why do I have this error?

Regards,

Diego F.
"Fitim Skenderi" <fi****@hotmail.com> escribió en el mensaje
news:uO**************@TK2MSFTNGP11.phx.gbl...
All serializable classes have to have a default constructor ie. a
constructor with no parameters. So you need to have a constructor with no
parameters, and your class has to have Serializable attribute. like

[Serializable] // the attrbute
public class Test
{
public Test() // default contructor
{
...
}
}

Fitim Skenderi

"Diego F." <di*****@NOterra.es> wrote in message
news:ed**************@TK2MSFTNGP10.phx.gbl...
Hello. I'm getting a serialization error with the following.

I'm doing an app that works with a webservice. The app and the WS has to
work with a class that I made as a DLL; I have some web methods that
receives objects from this class as parameters. Although it compiles,
when
I
try to add the web reference to the application, I get an error:
"Library.Class cannot be serialized because it does not have a default
public constructor. "

The class has a constructor where I set the attributes, and it's the


only
constructor.

Can you please help me?

Regards,

Diego F.




--
Regards,
Dilip Krishnan
MCAD, MCSD.net
dilipdotnet at apdiya dot com
Nov 16 '05 #4

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

Similar topics

4
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 (...
1
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...
4
by: james | last post by:
I upgraded my 2002 project to 2003 and I am getting several of there errors on my forms xxxForm.resx Resource transformation for file 'xxxForm.resx' failed. Possible Version mismatch. Type...
2
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
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...
0
by: ZippyV | last post by:
Hello everybody, I'm trying to convert a given xsd scheme to vb.net code with the help of xsd.exe. I've had no problems during conversion but the problem is that I can't build the code in vs.net....
2
by: yqlu | last post by:
I hava developed a client in C# that is connected to a 3-party XML Web Services developed in Java based on the AXIS 1.1. Most methods call are successful except for one method named "findObjects"...
5
by: Stacey Levine | last post by:
I have a webservice that I wanted to return an ArrayList..Well the service compiles and runs when I have the output defined as ArrayList, but the WSDL defines the output as an Object so I was...
2
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...
2
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.