By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,354 Members | 1,042 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,354 IT Pros & Developers. It's quick & easy.

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

P: n/a
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?


Nov 21 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a
no, I don't think so.
what is the problem you are trying to solve?
Are there ill-effects from this?

-D

"Developer" <lf@nospam.nospam> wrote in message
news:e2**************@TK2MSFTNGP09.phx.gbl...
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?

Nov 21 '05 #2

P: n/a
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.

"Dino Chiesa [Microsoft]" <di****@online.microsoft.com> wrote in message
news:ea**************@TK2MSFTNGP12.phx.gbl...
no, I don't think so.
what is the problem you are trying to solve?
Are there ill-effects from this?

-D

"Developer" <lf@nospam.nospam> wrote in message
news:e2**************@TK2MSFTNGP09.phx.gbl...
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?



Nov 21 '05 #3

P: n/a
what is the problem you are trying to solve?

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

-D

"Developer" <lf@nospam.nospam> wrote in message
news:eu***************@TK2MSFTNGP10.phx.gbl...
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.

"Dino Chiesa [Microsoft]" <di****@online.microsoft.com> wrote in message
news:ea**************@TK2MSFTNGP12.phx.gbl...
no, I don't think so.
what is the problem you are trying to solve?
Are there ill-effects from this?

-D

"Developer" <lf@nospam.nospam> wrote in message
news:e2**************@TK2MSFTNGP09.phx.gbl...
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?



Nov 21 '05 #4

P: n/a
> 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.

"Dino Chiesa [Microsoft]" <di****@online.microsoft.com> wrote in message
news:O2**************@TK2MSFTNGP09.phx.gbl...
what is the problem you are trying to solve?

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

-D

"Developer" <lf@nospam.nospam> wrote in message
news:eu***************@TK2MSFTNGP10.phx.gbl...
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.

"Dino Chiesa [Microsoft]" <di****@online.microsoft.com> wrote in message
news:ea**************@TK2MSFTNGP12.phx.gbl...
no, I don't think so.
what is the problem you are trying to solve?
Are there ill-effects from this?

-D

"Developer" <lf@nospam.nospam> wrote in message
news:e2**************@TK2MSFTNGP09.phx.gbl...
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?





Nov 21 '05 #5

P: n/a
I don't know the answer to those questions.
sorry.

"Developer" <lf@nospam.nospam> wrote in message
news:er**************@TK2MSFTNGP12.phx.gbl...
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.

"Dino Chiesa [Microsoft]" <di****@online.microsoft.com> wrote in message
news:O2**************@TK2MSFTNGP09.phx.gbl...
what is the problem you are trying to solve?

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

-D

"Developer" <lf@nospam.nospam> wrote in message
news:eu***************@TK2MSFTNGP10.phx.gbl...
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.

"Dino Chiesa [Microsoft]" <di****@online.microsoft.com> wrote in message
news:ea**************@TK2MSFTNGP12.phx.gbl...
no, I don't think so.
what is the problem you are trying to solve?
Are there ill-effects from this?

-D

"Developer" <lf@nospam.nospam> wrote in message
news:e2**************@TK2MSFTNGP09.phx.gbl...
> 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?
>
>
>
>




Nov 21 '05 #6

P: n/a
Al
Why don't you inherit from the proxy class and use attributes in this class?

"Developer" wrote:
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.

"Dino Chiesa [Microsoft]" <di****@online.microsoft.com> wrote in message
news:O2**************@TK2MSFTNGP09.phx.gbl...
what is the problem you are trying to solve?

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

-D

"Developer" <lf@nospam.nospam> wrote in message
news:eu***************@TK2MSFTNGP10.phx.gbl...
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.

"Dino Chiesa [Microsoft]" <di****@online.microsoft.com> wrote in message
news:ea**************@TK2MSFTNGP12.phx.gbl...
no, I don't think so.
what is the problem you are trying to solve?
Are there ill-effects from this?

-D

"Developer" <lf@nospam.nospam> wrote in message
news:e2**************@TK2MSFTNGP09.phx.gbl...
> 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?
>
>
>
>




Nov 21 '05 #7

P: n/a
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.

--
Tomas Restrepo
to****@mvps.org
Nov 21 '05 #8

P: n/a
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.SoapHttpClientProtoc ol
{}

/// <remarks/>
[System.Xml.Serialization.XmlTypeAttribute(Namespac e=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.
"Al" <Al@discussions.microsoft.com> wrote in message
news:2F**********************************@microsof t.com...
Why don't you inherit from the proxy class and use attributes in this
class?

"Developer" wrote:
> 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.

"Dino Chiesa [Microsoft]" <di****@online.microsoft.com> wrote in message
news:O2**************@TK2MSFTNGP09.phx.gbl...
> what is the problem you are trying to solve?
>
> can you just modify the generated code to include the attribute you
> want?
>
> -D
>
> "Developer" <lf@nospam.nospam> wrote in message
> news:eu***************@TK2MSFTNGP10.phx.gbl...
>> 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.
>>
>> "Dino Chiesa [Microsoft]" <di****@online.microsoft.com> wrote in
>> message
>> news:ea**************@TK2MSFTNGP12.phx.gbl...
>>> no, I don't think so.
>>> what is the problem you are trying to solve?
>>> Are there ill-effects from this?
>>>
>>> -D
>>>
>>> "Developer" <lf@nospam.nospam> wrote in message
>>> news:e2**************@TK2MSFTNGP09.phx.gbl...
>>>> 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?
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>>
>
>




Nov 21 '05 #9

P: n/a
> 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.SoapHttpClientProtoc ol {}

/// <remarks/>
[System.Xml.Serialization.XmlTypeAttribute(Namespac e=http://tempuri.org/)]
<<<-------------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/archiv...30/222725.aspx

--
Tomas Restrepo
to****@mvps.org
Nov 21 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.