Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / August 2004

Tip: Looking for answers? Try searching our database.

How to tell wsdl.exe/VS.NET to put [Serializable] on classes

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Developer - 19 Aug 2004 03:08 GMT
Hi,

How can one tell wsdl.exe/VS.NET web service proxy generatioon to to put
[Serializable] on imported classes?
For example, i fin your web service you use a class:
[Serializable]
class Data
{
}

and in your method you return this data, the automatically generated client
side proxy will not have the [Serializable]
attribute set. Is there anything that controls this behavior?
Dino Chiesa [Microsoft] - 23 Aug 2004 22:00 GMT
no, I don't think so.
what is the problem you are trying to solve?
Are there ill-effects from this?

-D

> Hi,
>
[quoted text clipped - 9 lines]
> side proxy will not have the [Serializable]
> attribute set. Is there anything that controls this behavior?
Developer - 24 Aug 2004 01:16 GMT
The problem is that these classes are not Serializable across AppDomains
(Although XmlSerializer can serialize them just fine). And creating a class
that derives from these classes doesn't help either. Because even if you
mark derived class to be [Serializable] remoting this type still fails
because base class is not [Serializable]. So, one is forced into creating
exact duplicate classes with same fields and then copying data.

> no, I don't think so.
> what is the problem you are trying to solve?
[quoted text clipped - 16 lines]
>> side proxy will not have the [Serializable]
>> attribute set. Is there anything that controls this behavior?
Dino Chiesa [Microsoft] - 25 Aug 2004 05:31 GMT
what is the problem you are trying to solve?

can you just modify the generated code to include the attribute you want?

-D

> The problem is that these classes are not Serializable across AppDomains
> (Although XmlSerializer can serialize them just fine). And creating a
[quoted text clipped - 24 lines]
>>> side proxy will not have the [Serializable]
>>> attribute set. Is there anything that controls this behavior?
Developer - 25 Aug 2004 12:43 GMT
> can you just modify the generated code to include the attribute you want?

Of course, but it will get reset with next update of the file. What's the
reason for proxy generators not to include [Serialzable] attribute or to
provide some control over it.

> what is the problem you are trying to solve?
>
[quoted text clipped - 31 lines]
>>>> side proxy will not have the [Serializable]
>>>> attribute set. Is there anything that controls this behavior?
Dino Chiesa [Microsoft] - 25 Aug 2004 15:37 GMT
I don't know the answer to those questions.
sorry.

>> can you just modify the generated code to include the attribute you want?
>
[quoted text clipped - 38 lines]
>>>>> side proxy will not have the [Serializable]
>>>>> attribute set. Is there anything that controls this behavior?
Al - 30 Aug 2004 04:37 GMT
Why don't you inherit from the proxy class and use attributes in this class?

> > can you just modify the generated code to include the attribute you want?
>
[quoted text clipped - 37 lines]
> >>>> side proxy will not have the [Serializable]
> >>>> attribute set. Is there anything that controls this behavior?
Tomas Restrepo \(MVP\) - 30 Aug 2004 12:05 GMT
Al,

> Why don't you inherit from the proxy class and use attributes in this class?

That wouldn't work. He probably needs the Serializable attribute on the
message classes, not on the proxy itself.

Signature

Tomas Restrepo
tomasr@mvps.org

Developer - 31 Aug 2004 01:38 GMT
I need Serializable attribute on the various structs that are pulled in with
web service proxy.
i.e.:
public class Service1 : System.Web.Services.Protocols.SoapHttpClientProtocol
{}

/// <remarks/>
[System.Xml.Serialization.XmlTypeAttribute(Namespace=http://tempuri.org/)]
<<<-------------I want [Serializable] here
public class Data {}

And you can't do the following when remoting the type:
[Serializable]
class Data2: Data{}

Not going to work.

> Why don't you inherit from the proxy class and use attributes in this
> class?
[quoted text clipped - 45 lines]
>> >>>> side proxy will not have the [Serializable]
>> >>>> attribute set. Is there anything that controls this behavior?
Tomas Restrepo \(MVP\) - 31 Aug 2004 03:19 GMT
> I need Serializable attribute on the various structs that are pulled in with
> web service proxy.
[quoted text clipped - 6 lines]
> <<<-------------I want [Serializable] here
> public class Data {}

I'm happy to report that the latest version of WSContract First from
Christian Weyer can do this for you :)
http://weblogs.asp.net/cweyer/archive/2004/08/30/222725.aspx

Signature

Tomas Restrepo
tomasr@mvps.org


Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.