Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Indigo

Serailiaztion of objects as arguments

Update your Vista Drivers Update Your Drivers Now!!
 
 
Thread Tools Display Modes
Old 09-28-2006   #1 (permalink)
Chad Z. Hower
Guest


 

Serailiaztion of objects as arguments

In some old remoting code there is a method like:

void Foo(SomeObject o)

and o is automatically serialized. For web services I manually
serialized and deserialized it to byte[].

In WCF I initially did it as byte[] and everything worked fine. Then I
stumbled on the remoting code and decided it was worth a try. In WCF it
compiled fine, but on the client it generates a proxy type for it as it
would with webservices. The proxy is of course a duplicate but is not
directly transferrable from the local native type which is in the
common assembly that the server also uses.

This is pretty much what I expect. I'm fine with manually seralizing
and deserializing it into byte[]. But it piqued my curiosity. Is there
some way in WCF using an attribute or other to delcare it simply as:

void Foo(SomeObject o)

And have o serilialized and deserialized auotmatically? This would
require that the client though know that it is SomeObject, and not be
proxied into the client mapping as a new SomeObject based on the
descripton.

--
"Programming is an art form that fights back"
http://www.KudzuWorld.com/
Need a professoinal technical speaker at your event? See www.woo-hoo.net

My System SpecsSystem Spec
Old 09-28-2006   #2 (permalink)
Arkady Frenkel
Guest


 

Re: Serailiaztion of objects as arguments

Hi, Chad!
Nice to meet ( read ) you here after Marmara hotel , btw I'm still
interesting if you have some news about future plans of WCF for Windows CE.
But I see that you already not inside...

You can read about serialization model of objects in WCF on
http://blogs.msdn.com/sowmy/archive/...22/536747.aspx
in addition to
http://msdn.microsoft.com/msdnmag/is...n/default.aspx

I see that you try to avoid (Collection)DataContract/Serializable but -
that's the
way

Arkady

"Chad Z. Hower" <chad-ng@hower.org> wrote in message
news:%23wOlfGt4GHA.2596@TK2MSFTNGP06.phx.gbl...
> In some old remoting code there is a method like:
>
> void Foo(SomeObject o)
>
> and o is automatically serialized. For web services I manually
> serialized and deserialized it to byte[].
>
> In WCF I initially did it as byte[] and everything worked fine. Then I
> stumbled on the remoting code and decided it was worth a try. In WCF it
> compiled fine, but on the client it generates a proxy type for it as it
> would with webservices. The proxy is of course a duplicate but is not
> directly transferrable from the local native type which is in the
> common assembly that the server also uses.
>
> This is pretty much what I expect. I'm fine with manually seralizing
> and deserializing it into byte[]. But it piqued my curiosity. Is there
> some way in WCF using an attribute or other to delcare it simply as:
>
> void Foo(SomeObject o)
>
> And have o serilialized and deserialized auotmatically? This would
> require that the client though know that it is SomeObject, and not be
> proxied into the client mapping as a new SomeObject based on the
> descripton.
>
> --
> "Programming is an art form that fights back"
> http://www.KudzuWorld.com/
> Need a professoinal technical speaker at your event? See www.woo-hoo.net



My System SpecsSystem Spec
Old 09-28-2006   #3 (permalink)
Chad Z. Hower
Guest


 

Re: Serailiaztion of objects as arguments

Arkady Frenkel wrote:
> Nice to meet ( read ) you here after Marmara hotel , btw I'm still


Good to meet you again.

> interesting if you have some news about future plans of WCF for


Better to post here in fact and see if anyone replies.

> Windows CE. But I see that you already not inside...


Well technically I am until Saturday..
http://blogs.msdn.com/czhower/

> You can read about serialization model of objects in WCF on
> http://blogs.msdn.com/sowmy/archive/...22/536747.aspx
> in addition to
> http://msdn.microsoft.com/msdnmag/is...tation/default.
> aspx
>
> I see that you try to avoid (Collection)DataContract/Serializable but
> - that's the way


Those won't work for what I need to do. I'll check the URLs though.

In my case I need to serialize an object that WCF does not know about
and that I cannot control. All I can assume is that the object is in
fact serializable.

--
"Programming is an art form that fights back"
http://www.KudzuWorld.com/
Need a professoinal technical speaker at your event? See www.woo-hoo.net
My System SpecsSystem Spec
Old 09-28-2006   #4 (permalink)
Chad Z. Hower
Guest


 

Re: Serailiaztion of objects as arguments

Arkady Frenkel wrote:
> You can read about serialization model of objects in WCF on
> http://blogs.msdn.com/sowmy/archive/...22/536747.aspx
> in addition to
> http://msdn.microsoft.com/msdnmag/is...tation/default.
> aspx


Ok Im back - I read them. Nothing new I didn't know before.

Let me try to explain it better.

I have client and server. They both share a common assembly in which a
type is defined. When the client reference is made it sees this type
and makes a proxy type for it. So in the end I have two classes of the
same structure in the client - one in the common asm and one in the WCF
reference file.

Thats all perfect and by design. Thats how webservices worked and why
my older webservice code used byte[] to transfer the object.

Remoting on the other hand can share asms between client and server,
and in fact must do so. We all know why this is bad.

But I have an object which I cannot use from the reference file - it
has code and of course the proxy doesnt get this code because its just
a contract. In fact - in my case (and yes I realize that under normal
circumstances this is a bad design - but in my case its not the design
it is THE function) I have to transfer the whole object. Now the code I
transfer by passing / dupliating the asm.

But I have to serialize my LOCAL class, not the proxy, because that is
all I have a reference too.

So my assumption is that WCF cannot do this - becuase even though they
are interface compat - as far a C# sees them their only common ancestry
is object. So not even a typecase could pass them as compatible.

So my guess is that byte[] is the only way - and if so thats fine. Just
seeing if I missed something.


--
"Programming is an art form that fights back"
http://www.KudzuWorld.com/
Need a professoinal technical speaker at your event? See www.woo-hoo.net
My System SpecsSystem Spec
Old 09-28-2006   #5 (permalink)
Arkady Frenkel
Guest


 

Re: Serailiaztion of objects as arguments

Thanks for link , Chad and take care outside !
Ok, in the case you do serialization yourself and not want for WCF do the
job you can look at surrogate sample on
http://windowssdk.msdn.microsoft.com.../ms751540.aspx
Arkady

"Chad Z. Hower" <chad-ng@hower.org> wrote in message
news:e%23kZtyv4GHA.4256@TK2MSFTNGP03.phx.gbl...
> Arkady Frenkel wrote:
>> Nice to meet ( read ) you here after Marmara hotel , btw I'm still

>
> Good to meet you again.
>
>> interesting if you have some news about future plans of WCF for

>
> Better to post here in fact and see if anyone replies.
>
>> Windows CE. But I see that you already not inside...

>
> Well technically I am until Saturday..
> http://blogs.msdn.com/czhower/
>
>> You can read about serialization model of objects in WCF on
>> http://blogs.msdn.com/sowmy/archive/...22/536747.aspx
>> in addition to
>> http://msdn.microsoft.com/msdnmag/is...tation/default.
>> aspx
>>
>> I see that you try to avoid (Collection)DataContract/Serializable but
>> - that's the way

>
> Those won't work for what I need to do. I'll check the URLs though.
>
> In my case I need to serialize an object that WCF does not know about
> and that I cannot control. All I can assume is that the object is in
> fact serializable.
>
> --
> "Programming is an art form that fights back"
> http://www.KudzuWorld.com/
> Need a professoinal technical speaker at your event? See www.woo-hoo.net



My System SpecsSystem Spec
Old 09-28-2006   #6 (permalink)
Chad Z. Hower
Guest


 

Re: Serailiaztion of objects as arguments

Arkady Frenkel wrote:
> Thanks for link , Chad and take care outside !


I will, check out my new website as well.

> Ok, in the case you do serialization yourself and not want for WCF do
> the job you can look at surrogate sample on


That won't work either. That solves the problem of not having access to
object, but will still leave me with two versions on the client.

Remoting could do it, but only becuase remoting allowed (actaully
forced) users to share a common assembly.

--
"Programming is an art form that fights back"
http://www.KudzuWorld.com/
Need a professoinal technical speaker at your event? See www.woo-hoo.net
My System SpecsSystem Spec
Old 09-29-2006   #7 (permalink)
Chad Z. Hower
Guest


 

Re: Serailiaztion of objects as arguments

FWIW - I thougth about it more. The serialization maybe could have been
made to work, but because of how my asms are related and base classes
it seems it cannot find the common class.

But just guessing right now - dont have too much time to experiment
further. Manual serializtion works, if I rely on WCF it creates a proxy
for it.


--
"Programming is an art form that fights back"
http://www.KudzuWorld.com/
Need a professoinal technical speaker at your event? See www.woo-hoo.net
My System SpecsSystem Spec
 

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
vbscript arguments Big D VB Script 1 07-01-2008 08:15 PM
getting arguments from pipe luntain PowerShell 6 11-23-2007 10:15 AM
Getting arguments from STDIN when command line arguments are missing Audun Gjerken PowerShell 4 03-05-2007 04:01 AM
events, arguments, etc... fixitchris PowerShell 4 11-15-2006 08:59 AM
Arguments parsing =?Utf-8?B?VEhH?= PowerShell 1 07-13-2006 09:17 AM


Update your Vista Drivers Update Your Vista Drivers Now!!

Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008