Tuesday, October 19, 2004

VJs Tip Of The Day - October 19th 2004

Targeting Different Web Service URL Dynamically

When we add a web reference it is usually assumed that it is going to point to a fixed WSDL file... Well this can be changed or made configurable and here is how you can do it...
After you add a web reference to a web service... Right click the web reference and go to the properties... You will find property namely "Web Reference Url" which states the url of the WSDL file of the service... There is another property called "Url Behavior" which is set to Static by default... This is the property which you need to set to "Dynamic"... Once you are done setting the same... In the config file of your application add the following key....

<appSettings><add key="SearchEngine.Google.GoogleSearch" value=http://localhost/MyOwnSearchService/SillySearch.asmx/></appSettings>

In the value part of the config file you can change the value to any other WS that you feel like... Consider this in your design in case you are likely to change the Web Service or are often likely to keep yourself updated with the changes that the provider is doing...

PS: Corollary To Earlier Mail: Again I am feeling 24 hours are not enough.. Today even the Starbucks got closed before I could reach there, sit and ponder... It was cold outside and no one was jogging with his dog either, it seems that sometimes what ever perspective you take the day still seems to be bad... :-) Well the consolation today is that if everyday was very good and easy then where is fun in life... :-)

No comments: