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, interoperabilit y 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 2357
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, interoperabilit y 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 (interoperabili ty).
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******** ******@TK2MSFTN GP09.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, interoperabilit y 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 (interoperabili ty). 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******** ******@TK2MSFTN GP09.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.ToStr ing 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, interoperabilit y 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 Authentication. I
have a security constraint restricting access to the application so
that when I attempt to access the app I am redirected to the login
page. This works as expected both when accessing the application via
the Apache proxy or hitting...
|
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 Internet Explorer connection settings
(proxy:8080). However, as soon as this setting is enabled, the remoting
program running on their pc stops communicating with the server it sends
data to. I've disabled proxy setting on the affected pc, rebooted...
|
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 Internet. In addition, the proxy
require us to authenticated before allow us to go through it.
I have coded something like below (without changing anything other things):
WebProxy proxyObject = new WebProxy("proxy.myUni.edu.au", 8080); //
|
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 adding a WebReference, since it does not
allow me to keep state (cookiecontainer) or to specify functions on the
classes (like if i want to override the ToString() function on a class from
my webservice). So the only way i can see how i can get...
|
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 that will be useful in diagnosing
the problem.
I have an application which calls a method of a web service
that we host remotely. I have deployed the application to a
| |
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.
Unfortunately, the .NET Framework does not support automatic proxy discovery
scripts. See:
http://support.microsoft.com/default.aspx?scid=kb;%5BLN%5D;307220
The article above details that the way to workaround this is to edit the...
|
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 out:
I've a win32 service in C# on a client machine A, which accesses a WS
(C#) on a server machine B (hosted on an IIS)
Case 1:
If I try to add the WSDL for the WS through VS2005, the 'Discovery
|
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 HttpWebRequest object.
Under normal circumstances I am able to use the webservice without any
problems. But after using an HttpWebRequest object to make a call to a
website
all subsequent attempts to use the WebService will fail with a 401...
|
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 407 Proxy Authentication Required.
The same request through the old proxy succeeds.
The same request to an HTTP address through the new proxy succeeds.
Also, the request succeeds when forced to use Basic authentication but fails
on NTLM.
|
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
this exception:
System.Net.WebException: The request failed with HTTP status 407: Proxy Authentication Required.
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message,
WebResponse response, Stream...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |