473,396 Members | 1,743 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,396 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 1419
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: 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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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...
0
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,...

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.