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

proxy proxy problem

P: n/a
Hi,

I have a webservice method that returns an instance of a custom class I
created (e.g., bank account).
The class definition in the webservice contains properties, overrides
Object.ToString method and etc.
However, the proxy created for the webservice contains a definition for this
class without the code I wrote. Instead it contains only public fields. I
understand the reason, interoperability with none .net clients, but is there
someway in .net clients to have the same code as in the webservice itself?

Thanks in advance, Ohad

--
Ohad Young
Medical Informatics Research Center
Ben Gurion University
Information System Eng
Office Phone: 972-8-6477160
Cellular Phone: 972-54-518301
E-Mail: oh****@bgumail.bgu.ac.il
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Technically, you can have the same code implement the objects that
represent your web service messages on the server and client. You'll
want to study your architecture closely and make sure that's a good idea.

Use the proxy generation tool (wsdl or vs.net) to create the client
proxy. Then, open the generated file and modify the parameter and return
types to use the same classes that you used to implement the web
service. Note that you will have to do this everytime the web service
interface definition changes - you won't be able to simply rerun the
tool to update the proxy.

Also, you should understand that unlike binary serialization, the entire
state of the object is not being serialized in xml serialization - only
the public properties/fields that are read/write. That alone may negate
the reasons you want to share class code on the client and server.

Drew

Ohad Young wrote:
Hi,

I have a webservice method that returns an instance of a custom class I
created (e.g., bank account).
The class definition in the webservice contains properties, overrides
Object.ToString method and etc.
However, the proxy created for the webservice contains a definition for this
class without the code I wrote. Instead it contains only public fields. I
understand the reason, interoperability with none .net clients, but is there
someway in .net clients to have the same code as in the webservice itself?

Thanks in advance, Ohad

Nov 21 '05 #2

P: n/a
Hi Drew,

Thanks for the reply, actually this is what I did so far.
You'll want to study your architecture closely and make sure that's a good idea.
I wanted to use data-binding in the GUI (to a ComboBox Class instance). The
data-binding requires the instance to have two public properties, public
fields are not sufficient. Another option was to have a custom ToString()
method.
However, both of the options are problematic due to the proxy generation
result, it doesn't include the public properties nor the custom ToString()
method for understandable reasons (interoperability).
It is tedious to update the proxy every time the webservice changes.
What do you think of using a client class that will receive in the
constructor an instance of the returned webservice class instance?
That way we decouple the dependency between the GUI and the server.

Ohad

"Drew Robbins" <"drew at drewby.com"> wrote in message
news:eL**************@TK2MSFTNGP09.phx.gbl... Technically, you can have the same code implement the objects that
represent your web service messages on the server and client. You'll
want to study your architecture closely and make sure that's a good idea.

Use the proxy generation tool (wsdl or vs.net) to create the client
proxy. Then, open the generated file and modify the parameter and return
types to use the same classes that you used to implement the web
service. Note that you will have to do this everytime the web service
interface definition changes - you won't be able to simply rerun the
tool to update the proxy.

Also, you should understand that unlike binary serialization, the entire
state of the object is not being serialized in xml serialization - only
the public properties/fields that are read/write. That alone may negate
the reasons you want to share class code on the client and server.

Drew

Ohad Young wrote:
Hi,

I have a webservice method that returns an instance of a custom class I
created (e.g., bank account).
The class definition in the webservice contains properties, overrides
Object.ToString method and etc.
However, the proxy created for the webservice contains a definition for this class without the code I wrote. Instead it contains only public fields. I understand the reason, interoperability with none .net clients, but is there someway in .net clients to have the same code as in the webservice itself?
Thanks in advance, Ohad

Nov 21 '05 #3

P: n/a
I think that your idea of using the webservice data in a constructor of
your client object is a better approach than tightly coupling the
webservice client/server code.

Its similar to the Memento pattern
(http://www.dofactory.com/patterns/PatternMemento.aspx) which is a great
way to store/retrieve the serialized state of an object without
defeating the benefits of encapsulation.

Ohad Young wrote:
Hi Drew,

Thanks for the reply, actually this is what I did so far.

You'll want to study your architecture closely and make sure that's a good


idea.
I wanted to use data-binding in the GUI (to a ComboBox Class instance). The
data-binding requires the instance to have two public properties, public
fields are not sufficient. Another option was to have a custom ToString()
method.
However, both of the options are problematic due to the proxy generation
result, it doesn't include the public properties nor the custom ToString()
method for understandable reasons (interoperability).
It is tedious to update the proxy every time the webservice changes.
What do you think of using a client class that will receive in the
constructor an instance of the returned webservice class instance?
That way we decouple the dependency between the GUI and the server.

Ohad

"Drew Robbins" <"drew at drewby.com"> wrote in message
news:eL**************@TK2MSFTNGP09.phx.gbl...
Technically, you can have the same code implement the objects that
represent your web service messages on the server and client. You'll
want to study your architecture closely and make sure that's a good idea.

Use the proxy generation tool (wsdl or vs.net) to create the client
proxy. Then, open the generated file and modify the parameter and return
types to use the same classes that you used to implement the web
service. Note that you will have to do this everytime the web service
interface definition changes - you won't be able to simply rerun the
tool to update the proxy.

Also, you should understand that unlike binary serialization, the entire
state of the object is not being serialized in xml serialization - only
the public properties/fields that are read/write. That alone may negate
the reasons you want to share class code on the client and server.

Drew

Ohad Young wrote:
Hi,

I have a webservice method that returns an instance of a custom class I
created (e.g., bank account).
The class definition in the webservice contains properties, overrides
Object.ToString method and etc.
However, the proxy created for the webservice contains a definition for
this
class without the code I wrote. Instead it contains only public fields.
I
understand the reason, interoperability with none .net clients, but is
there
someway in .net clients to have the same code as in the webservice
itself?
Thanks in advance, Ohad


Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.