hi guys! can anybody please help me. I have a Web Reference under my Web References. How can i change the 'Web Reference Url' property of that programmatically? Thanks in advance!
Printable View
hi guys! can anybody please help me. I have a Web Reference under my Web References. How can i change the 'Web Reference Url' property of that programmatically? Thanks in advance!
Are you talking a web service?
Create an instance of the web service, and set the (if memory serves correctly) Url property.
Alternatively, set the Behavior property to "Dynamic" - a web.config entry will be created with the current URL, and you may change this at will.
http://www.google.co.za/search?q=c%2...ient=firefox-a
Yap! a web referenced to Sharepoint Web Service.
I assumed that you already have a wisdil file in your project. In the wisdil file .cs you can make another constructor that accept a string. That string is the new url address. I hope I make myself clear.
I dont have wisdil. How can i have wisdil in my project?
Popskie's referring to the proxy class (i.e. the class you instantiate when you wish to query the web service) generated when you add a web reference - if you show all files within a project, the web reference will have a WSDL file, and a .cs proxy.
Popskie's solution will work, however, if you ever update the web reference, you will have to manually recreate the constructor.
It would be easiest to set the web reference's "Behaviour" property to dynamic; as said before, an appSetting entry will be created in the application's [app/web].config file - this will be loaded when you create an instance of the web service.
Reference material
Ok. Thanks a bunch for the input guys!