473,903 Members | 5,852 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WebService Proxy Classes (using wsdl.exe) ! Need expert help ! MS PEOPLE ?

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 (cookiecontaine r) 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 this option, is to
generate proxyclasses through wsdl.exe and add the class to my project.

It all works fine, but there's the deal... When I need to switch between a
Development build and a Test build, i've made entries in the Visual Studio
Configuration Manager (which I use with the #if and #endif). It allows me to
take different connectionstrin gs from the web.config etc.

But since I've generated my Proxy classes through wsdl.exe, it's constructor
has the folllwing line;

this.Url = "http://myserver/mywebservice/myservice.asmx" ;

This I could wrap with #if and #endif like so;

#if DEV
this.Url = "http://mydevserver/mywebservice/myservice.asmx" ; // Notice
myDEVserver
#endif

#if TEST
this.Url = "http://mytestserver/mywebservice/myservice.asmx" ; // Notice
myTESTserver
#endif

I also works just fine ! This way i can easily change between enviroments !

B U T (and here's the thing...) when i change a webservice, like
adding/deleting functions, I need to either; 1) edit the proxy class
manually, removing or adding the functions (beginInvoke... , endInvoke...)
corresponding to the changes, OR 2) re-generate the proxy class.

It's easy to see, that if you have a huge project, with loads of webservices
which changes alot, you have to do this alot of times. The problem is, that
when i re-generate the proxy classes, all my functions on the classes in the
proxyclass are overridden, and I have to manually copy them to the clipboard
or something like that, and paste them into the new proxy class, to keep
them.

THIS IS VERY TIME CONSUMING - and frankly drives me crazy !

Dos somebody have a nice solution to this "work process problem" ?

I'm using "Microsoft Development Enviroment 2002" (Microsoft Visual Studio
..NET).

Please help.

Thanks,

Benne

Nov 15 '05 #1
5 3492
Yeah, I'm in the same boat as you. Same exact problem :(

Something I did to make it easier (although initially just as time
consuming) was to write a VS AddIn app to manipulate my proxy files
generated with wsdl based on parameters I want to alter (ie -- adding DEBUG
flag, overrides, etc...). I know this probably isn't the solution you're
looking for but, once it is set up, it is easy to maintain. There might
even be a good, free tool that does this -- I haven't checked in a couple
years.

Alex

"Benne Smith" <do**@write.to. me.directly.com > wrote in message
news:40******** *************@n ews.dk.uu.net.. .
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 (cookiecontaine r) 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 this option, is to
generate proxyclasses through wsdl.exe and add the class to my project.

It all works fine, but there's the deal... When I need to switch between a
Development build and a Test build, i've made entries in the Visual Studio
Configuration Manager (which I use with the #if and #endif). It allows me to take different connectionstrin gs from the web.config etc.

But since I've generated my Proxy classes through wsdl.exe, it's constructor has the folllwing line;

this.Url = "http://myserver/mywebservice/myservice.asmx" ;

This I could wrap with #if and #endif like so;

#if DEV
this.Url = "http://mydevserver/mywebservice/myservice.asmx" ; // Notice myDEVserver
#endif

#if TEST
this.Url = "http://mytestserver/mywebservice/myservice.asmx" ; // Notice myTESTserver
#endif

I also works just fine ! This way i can easily change between enviroments !
B U T (and here's the thing...) when i change a webservice, like
adding/deleting functions, I need to either; 1) edit the proxy class
manually, removing or adding the functions (beginInvoke... , endInvoke...)
corresponding to the changes, OR 2) re-generate the proxy class.

It's easy to see, that if you have a huge project, with loads of webservices which changes alot, you have to do this alot of times. The problem is, that when i re-generate the proxy classes, all my functions on the classes in the proxyclass are overridden, and I have to manually copy them to the clipboard or something like that, and paste them into the new proxy class, to keep
them.

THIS IS VERY TIME CONSUMING - and frankly drives me crazy !

Dos somebody have a nice solution to this "work process problem" ?

I'm using "Microsoft Development Enviroment 2002" (Microsoft Visual Studio
.NET).

Please help.

Thanks,

Benne

Nov 15 '05 #2
Modifying generated web service proxies is almost always a bad idea, as
you've already discovered yourself. There are ways to handle this situation
that are better than modifying the proxy code.

First off, you can make the proxies dynamic instead of static (the 'URL
Behavior' field in the properties of the proxy in VS.NET). You can then
provide the URLs through a config file.

Alternatively, you could derive a class from the proxy class. In the
constructor of the subclass, assign to the base class's Url property:

public class MyProxySubClass : WebServiceProxy
{
public void MyProxySubClass ()
{
#if DEV
base.Url = "http://mydevserver/mywebservice/myservice.asmx" ;
#endif
#if TEST
base.Url = "http://mytestserver/mywebservice/myservice.asmx" ;
#endif
}
}

Then in your application you use the subclass instead of the generated proxy
class to access the web service. This way, if the proxy is regenerated you
do not lose the changes.

Finally, it is also possible to write your own web service proxy generator.
This is admittably a bit more work but not impossibly so as .NET provides
much of the plumbing (see the ServiceDescript ionImporter class).

hth,
Sami
www.capehill.net

"Trebek" <tr****@inthefo rmofaquestion.c om> wrote in message
news:40******** *************** @nnrp.fuse.net. ..
Yeah, I'm in the same boat as you. Same exact problem :(

Something I did to make it easier (although initially just as time
consuming) was to write a VS AddIn app to manipulate my proxy files
generated with wsdl based on parameters I want to alter (ie -- adding DEBUG flag, overrides, etc...). I know this probably isn't the solution you're
looking for but, once it is set up, it is easy to maintain. There might
even be a good, free tool that does this -- I haven't checked in a couple
years.

Alex

"Benne Smith" <do**@write.to. me.directly.com > wrote in message
news:40******** *************@n ews.dk.uu.net.. .
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 (cookiecontaine r) 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 this option, is to generate proxyclasses through wsdl.exe and add the class to my project.

It all works fine, but there's the deal... When I need to switch between a Development build and a Test build, i've made entries in the Visual Studio Configuration Manager (which I use with the #if and #endif). It allows me to
take different connectionstrin gs from the web.config etc.

But since I've generated my Proxy classes through wsdl.exe, it's constructor
has the folllwing line;

this.Url = "http://myserver/mywebservice/myservice.asmx" ;

This I could wrap with #if and #endif like so;

#if DEV
this.Url = "http://mydevserver/mywebservice/myservice.asmx" ; //

Notice
myDEVserver
#endif

#if TEST
this.Url = "http://mytestserver/mywebservice/myservice.asmx" ; //

Notice
myTESTserver
#endif

I also works just fine ! This way i can easily change between

enviroments !

B U T (and here's the thing...) when i change a webservice, like
adding/deleting functions, I need to either; 1) edit the proxy class
manually, removing or adding the functions (beginInvoke... ,

endInvoke...) corresponding to the changes, OR 2) re-generate the proxy class.

It's easy to see, that if you have a huge project, with loads of

webservices
which changes alot, you have to do this alot of times. The problem is,

that
when i re-generate the proxy classes, all my functions on the classes in

the
proxyclass are overridden, and I have to manually copy them to the

clipboard
or something like that, and paste them into the new proxy class, to keep
them.

THIS IS VERY TIME CONSUMING - and frankly drives me crazy !

Dos somebody have a nice solution to this "work process problem" ?

I'm using "Microsoft Development Enviroment 2002" (Microsoft Visual Studio .NET).

Please help.

Thanks,

Benne


Nov 15 '05 #3
Hi, Benne

You should be able to inherit from the classes to override necessary methods (like ToString()) and
constructors. Isn't it true?
Benne Smith wrote:
Hi,
It's easy to see, that if you have a huge project, with loads of webservices
which changes alot, you have to do this alot of times. The problem is, that
when i re-generate the proxy classes, all my functions on the classes in the
proxyclass are overridden, and I have to manually copy them to the clipboard
or something like that, and paste them into the new proxy class, to keep
them.

THIS IS VERY TIME CONSUMING - and frankly drives me crazy !

Dos somebody have a nice solution to this "work process problem" ?
Benne

--
Dmitry Kostenko
Nov 15 '05 #4
Sami, thanks for your reply ! It's a very good idea to make a "wrapper"
class around the proxy, so i can keep my manually edited things. Cheers !
Why didn't I think of that ?? :-)

Then the only thing I need would be to create a AddIn to generate all proxy
classes, based on the active configuration (Development, Test, Production),
then it should work !

Thanks.

:-) Benne Smith
"Sami Vaaraniemi" <sa************ ***@jippii.fi> wrote in message
news:c2******** **@phys-news1.kolumbus. fi...
Modifying generated web service proxies is almost always a bad idea, as
you've already discovered yourself. There are ways to handle this situation that are better than modifying the proxy code.

First off, you can make the proxies dynamic instead of static (the 'URL
Behavior' field in the properties of the proxy in VS.NET). You can then
provide the URLs through a config file.

Alternatively, you could derive a class from the proxy class. In the
constructor of the subclass, assign to the base class's Url property:

public class MyProxySubClass : WebServiceProxy
{
public void MyProxySubClass ()
{
#if DEV
base.Url = "http://mydevserver/mywebservice/myservice.asmx" ;
#endif
#if TEST
base.Url = "http://mytestserver/mywebservice/myservice.asmx" ;
#endif
}
}

Then in your application you use the subclass instead of the generated proxy class to access the web service. This way, if the proxy is regenerated you
do not lose the changes.

Finally, it is also possible to write your own web service proxy generator. This is admittably a bit more work but not impossibly so as .NET provides
much of the plumbing (see the ServiceDescript ionImporter class).

hth,
Sami
www.capehill.net

"Trebek" <tr****@inthefo rmofaquestion.c om> wrote in message
news:40******** *************** @nnrp.fuse.net. ..
Yeah, I'm in the same boat as you. Same exact problem :(

Something I did to make it easier (although initially just as time
consuming) was to write a VS AddIn app to manipulate my proxy files
generated with wsdl based on parameters I want to alter (ie -- adding DEBUG
flag, overrides, etc...). I know this probably isn't the solution you're
looking for but, once it is set up, it is easy to maintain. There might
even be a good, free tool that does this -- I haven't checked in a couple years.

Alex

"Benne Smith" <do**@write.to. me.directly.com > wrote in message
news:40******** *************@n ews.dk.uu.net.. .
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 (cookiecontaine r) 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 this option, is to generate proxyclasses through wsdl.exe and add the class to my
project.
It all works fine, but there's the deal... When I need to switch between
a Development build and a Test build, i've made entries in the Visual Studio Configuration Manager (which I use with the #if and #endif). It allows me
to
take different connectionstrin gs from the web.config etc.

But since I've generated my Proxy classes through wsdl.exe, it's

constructor
has the folllwing line;

this.Url = "http://myserver/mywebservice/myservice.asmx" ;

This I could wrap with #if and #endif like so;

#if DEV
this.Url = "http://mydevserver/mywebservice/myservice.asmx" ; //

Notice
myDEVserver
#endif

#if TEST
this.Url = "http://mytestserver/mywebservice/myservice.asmx" ; //

Notice
myTESTserver
#endif

I also works just fine ! This way i can easily change between enviroments
!

B U T (and here's the thing...) when i change a webservice, like
adding/deleting functions, I need to either; 1) edit the proxy class
manually, removing or adding the functions (beginInvoke... ,

endInvoke...) corresponding to the changes, OR 2) re-generate the proxy class.

It's easy to see, that if you have a huge project, with loads of

webservices
which changes alot, you have to do this alot of times. The problem is,

that
when i re-generate the proxy classes, all my functions on the classes
in the
proxyclass are overridden, and I have to manually copy them to the

clipboard
or something like that, and paste them into the new proxy class, to

keep them.

THIS IS VERY TIME CONSUMING - and frankly drives me crazy !

Dos somebody have a nice solution to this "work process problem" ?

I'm using "Microsoft Development Enviroment 2002" (Microsoft Visual

Studio .NET).

Please help.

Thanks,

Benne



Nov 15 '05 #5
Dmitry, yes it's correct. Also "Sami" answered this in another post.

However, now my problem is how to access my Compiler Constants from inside a
macro/addin ! Do you have any idea how to do that ?? (I've made another
posting today about this).
"Dmitry Kostenko" <dkos@isd_.dp_. ua_> wrote in message
news:c2******** *@mfdebug.isd.d p.ua...
Hi, Benne

You should be able to inherit from the classes to override necessary methods (like ToString()) and constructors. Isn't it true?
Benne Smith wrote:
Hi,
It's easy to see, that if you have a huge project, with loads of webservices which changes alot, you have to do this alot of times. The problem is, that when i re-generate the proxy classes, all my functions on the classes in the proxyclass are overridden, and I have to manually copy them to the clipboard or something like that, and paste them into the new proxy class, to keep
them.

THIS IS VERY TIME CONSUMING - and frankly drives me crazy !

Dos somebody have a nice solution to this "work process problem" ?
Benne

--
Dmitry Kostenko

Nov 15 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
9911
by: ffhansix | last post by:
Hi, I am having problems with generating a c# proxy class from a IBM websphere WSDL file, when running the wsdl.exe to create the c# proxy file command i recieve an error: Warning: one or more operations were skipped. Warnings were encountered. Review generated source comments for more details.
2
1962
by: farseer | last post by:
Hi, I have a few webservice questions i'd like to bounce of you... 1. Can a webservice contain a paramterized contructor ( can't the contructor take parameters )? 2. If two users make an initial call to a webservice, will diferent instances of the webservice object be instantiated on the server? (assuming the service is not designed to be a singleton)
6
1342
by: Brad | last post by:
I have a web service which returns a collection of class object (see below). I want to consume this service in another web application by binding it to a List control The data returns from the web service, however when I bind the data I get the following error **** DataBinder.Eval: 'UserServices.User' does not contain a property with the name FirstName. **** Debugging I see that the list controls data source is a System.Array with...
4
8282
by: Adrian Meyer | last post by:
Hi, On the server I code the following web service: ))] public XmlDataDocument GetTypedXmlDataDocument() { sqlDataAdapter1.Fill(typedDataSet1); XmlDataDocument dataDoc
2
2764
by: yqlu | last post by:
I hava developed a client in C# that is connected to a 3-party XML Web Services developed in Java based on the AXIS 1.1. Most methods call are successful except for one method named "findObjects" and return a complex type "FieldSearchResult". The error message as following : "Cannot assign object of type System.String to an object of type System.String. There is an error in XML document (23, 97)." By the way,I hava written a client in Java...
7
2931
by: Nalaka | last post by:
Hi, I created a sinple web service that returns a dataSet. Then I created a client program that uses this web service (that returns the Dataset). My question is, how did the client figure out to create a "DataSet" as the return type from the webservice?
3
2272
by: Mark | last post by:
I'm consuming a webservice that makes a simple object available. The object class is marked in the web service as . I have a web application that consumes and uses this web service's class. When I receive the object from the web service, I'm interested in storing that object in ViewState in the web application, but I receive the error below. I'm not shocked that the web application can't serialize the object as the attribute isn't...
3
5409
by: Arpan | last post by:
Web Services make use of proxy classes whose methods & properties are accessed in exactly the same way as how a normal class' methods & properties are accessed. So what for does ASP.NET generate proxy classes (using WSDL) which consume more hard disk space & resources? For e.g. consider the following code which exists in a user-defined class file: Imports System Imports System.Data
1
1259
by: Asfar | last post by:
Hi, I have developed my first webservice using Web Service Software Factory provided by Microsoft. Java client will consume my webservice. Now my question is what information do i need to provide to the developer who will be developing the Java client. Should I just use wsdl.exe and generate the proxy class for my asmx file and send the generated *.cs file to the developer?
0
10004
marktang
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...
0
9853
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,...
0
10882
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10989
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,...
1
8057
isladogs
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...
0
7215
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();...
0
6100
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4734
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
2
4315
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.