Greger,
It's a good question. You can pass Custom objects to and from Web Services.
In your case , the Person Object, should have Public Properties to depitct
the details of the Person Object
As long as the properties of the Person object are a primitive types, you
don't have to bother too much. Look at the sample below ...
Public Class Person
Public Property PersonId as Integer
Public Property PersonName as String
End Class
If atleast one of the Property of the Person object is a CusomCollection,
you need to consider lot of things before passing objects to and from web
services.
The following scenario has address collection inside Person Object
Public Class Person
Public Property PersonId as Integer
Public Property PersonName as String
Public Propery PersonAddress as AddressCollection
End Class
In such case the Custom Collections are not transmitted directly between web
services and clients. Meaning Custom Collections are passed as Array of
Objecs.
If if it is passed as Array of Objects, you loose tight coupling between
Person Object and AddressCollection property. In this scenario you really
need to figure out a way to maintain the tight coupling between Person Object
and AddressCollection Propery.
The way to do is to enable tight coupling with PersonId. Meaning
have a defintion for PersonId in the AddressCollection.
Please let me know if this reply is useful. If you need more information let
me know.
-
Thanks & Regards,
Sundar Narasimman
> Hi,
>
[quoted text clipped - 25 lines]
>
> Regards Greger
Greger - 20 Sep 2006 11:56 GMT
Hi Sundar,
Thanxs for the reply.
The gist of the question is when I send the proxy object to the server and
the server tries to recreate my object. It wont be able to set the,
intentionally, private set property. Leaving my object without essential data.
How can I have the framework deserialize my object correctly even though it
has a pricate set?
Regards Greger

Signature
----
> Greger,
>
[quoted text clipped - 66 lines]
> >
> > Regards Greger
Sundar Narasimman - 21 Sep 2006 12:35 GMT
Hi Greger,
Niow I can understand your problem better.
There is a way to do that. You can have a Public method in the Remote Object
to update the private property/member of the class.
Your remote Person object can have public and private properties/method.
As you know only Public properties/methods would be serialized back and
forth between Web Services and the Client. Meaning at the client-side, the
proxy will reflect only Public Properties/Methods of the remote object.
You can still call the Public method of the proxy, that inturn will get
executed at the server-side to update your private property/member.
This is really possible.
Pls let me know whether this is useful or you need more information
regarding this

Signature
Thanks & Regards,
Sundar Narasimman
Technology Specialist
Microsoft .NET
> Hi Sundar,
>
[quoted text clipped - 78 lines]
> > >
> > > Regards Greger
Ben Joyce - 21 Sep 2006 09:31 GMT
Wow, I didn't even know this was possible... so, you can serialize
custom classes in .net and send them over the web? I am understanding
this right?
Ben
> Greger,
>
[quoted text clipped - 66 lines]
> >
> > Regards Greger
Sundar Narasimman - 21 Sep 2006 12:29 GMT
Hi Ben,
Yes you are right. You can serialize custom objects over the web . You can
even serialize custom object collections.
Thanks & Regards,
Sundar
> Wow, I didn't even know this was possible... so, you can serialize
> custom classes in .net and send them over the web? I am understanding
[quoted text clipped - 72 lines]
> > >
> > > Regards Greger
Prerak V. Shah - 27 Feb 2007 21:48 GMT
Hi,
Your information is quite useful and I have one more question to it.
I am having one custom object which I accept as a parameter of my webmethod.
This object is getting generated in my proxy class of the webservice at the
consumer-end.
Now, I am not getting any of my public methods of my custom object in
generated proxy class. I am not getting even constructors.
Actually I am having one private variable of the type "object" in my custom
class "WebResponse". Depending on the type of the value it contains, I am
having public methods to return it's value. but I am not getting any of these
public methods in the proxy class.
Is there any way out here!
Thanks,
Prerak
> Hi Ben,
>
[quoted text clipped - 80 lines]
> > > >
> > > > Regards Greger
Mariano Omar Rodriguez - 07 Mar 2007 21:14 GMT
Custom objects are serialized with XmlSerializer, it only transport public
properties.
> Hi,
>
[quoted text clipped - 126 lines]
>> > > >
>> > > > Regards Greger