473,394 Members | 1,951 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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 (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 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 connectionstrings 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 3430
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*********************@news.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 (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 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 connectionstrings 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 ServiceDescriptionImporter class).

hth,
Sami
www.capehill.net

"Trebek" <tr****@intheformofaquestion.com> 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*********************@news.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 (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 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 connectionstrings 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 ServiceDescriptionImporter class).

hth,
Sami
www.capehill.net

"Trebek" <tr****@intheformofaquestion.com> 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*********************@news.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 (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 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 connectionstrings 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.dp.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
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...
2
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...
6
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...
4
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
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"...
7
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...
3
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...
3
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...
1
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...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
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,...
0
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...

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.