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

change web proxy method attribute at run time

P: n/a
Here is what I have and what I would like to do:
I am building a web client application.
I add a web reference to some web service server to my project so that
now I can call the web service.
A proxy class is generated for me. This is nice. It works!
Now, the method that is generated in the proxy class has an attribute
preceding it that, among other things, contains the web address of the
web service and the particular method at that service to be called
like this:
System.Web.Services.Protocols.SoapRpcMethodAttribu te("http://some.machine/service/procedure",
, RequestNamespace="urn:querywsdl",

There will be more than one web service with the same interfaces
available for use. I will not know there names or locations at design
time. I would like to use this proxy class that I already have to
access the various different web services. Apparently the attribute
above controls where my call will go.

Is there some way to change this attribute value at run time? I tried
to create a variable and plug it in for the first value like this:

string MyParamater = "http://Set_this_machine_loc/at_run/time"
and then plug that in like this:
System.Web.Services.Protocols.SoapRpcMethodAttribu te(MyParamater,
, RequestNamespace="urn:querywsdl",

which causes a compile error "An attribute argument must be a constant
expression, typeof expression or array creation expression"
OK, so I cant plug in a variable. Is there some way to reuse this
proxy code while changing the destination service address and
procedure name at run time?
Would I have to write my own proxy class at some lower level?
Is there a way to intercept this message before it is sent to make the

Any suggestions, links, how to are much needed and appreciated.

Thanks in advance
Nov 12 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.