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 3 2333
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
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
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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Kevin Sagon |
last post by:
I am running a J2EE Web App under Tomcat 4.1 with Apache 2.0 proxying
requests. Everything is configured and working appropriately however
I ran into a problem after configuring J2EE Form...
|
by: harry |
last post by:
Hi,
I have a program that runs on multiple client pc's. Occasionally one or more
of those pc's use VPN to connect to another corporate network. When using
VPN they need to set proxy server in...
|
by: Soul |
last post by:
Hi,
I am learning to code a WinForm application which will need to access a Web
Service outside the University network. Our University require us to go
through a proxy in order to access the...
|
by: Benne Smith |
last post by:
Hi,
I have three enviroments; a development, a testing and a production
enviroment. I'm making a big application (.exe), which uses alot of
different webservices.
I don't use the webservices...
|
by: Wild Wind |
last post by:
Hello all,
I apologise in advance for the long windedness of
this post, but I feel that if I am going to get any
solution to this problem, it is important that I present
as much information...
| |
by: Codex Twin |
last post by:
I am re-sending this in the hope that it might illicit a response. I have a
corporate client who forces their workstations to get the proxy server
details using an automatic proxy discovery script....
|
by: rcp |
last post by:
Hi all,
I've read all posts from all existing threads and none of them worked
to solve my problem, although its exactly the same. I'll try to
explain my case and see if a kind soul could help me...
|
by: =?Utf-8?B?TGFycnlLdXBlcm1hbg==?= |
last post by:
Our WebDev team seems to have found a problem that exposes a bug in .NET 2.0.
This problem can be shown when trying to access a WebService using SSL and
through a proxy server after using the...
|
by: =?Utf-8?B?TGVuc3Rlcg==?= |
last post by:
A C# (.NET 2) application which uses the System.Net.HttpWebRequest object to
request a resource over HTTPS is failing following the installation of a new
proxy server on our internal network with...
|
by: Jon |
last post by:
I wrote a VS 2005 C# express programme that accesses a web service. It works fine when there's a
direct connection to the internet, but on two different PCs with internet access via a proxy, I get...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |