CJLeit Posted August 9, 2006 Posted August 9, 2006 Hello, I have a project that calls a web services but it needs to call a different version of the service based on the environment I'm working in. I have this working with the code sample below but doing it this way I lose the intellisense for the web service. Is there a way to do late binding and still use intellisense? Dim wsVendPart As Object If bTestEnviornment = False Then wsVendPart = New VendPart.VendPartServiceWse Else wsVendPart = New VendPartTest.VendPartServiceWse End If Quote
Administrators PlausiblyDamp Posted August 9, 2006 Administrators Posted August 9, 2006 Are the two web services essentially the same but hosted on different URLs? If so you could just create a single web reference and then either change it's type to dynamic (from the properties window) which will allow you to edit the .config file and specify a url. Alternatively you could just set the URL property of the webservice at runtime to the correct service. Generally speaking I would also suggest turning Option Strict On for VB projects and avoiding late binding altogether if possible. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
CJLeit Posted August 9, 2006 Author Posted August 9, 2006 They are essentially the same webservice just looking at a different URLs. Is there an easy way in code to chage the app.config to look at different URL's? Thanks! Are the two web services essentially the same but hosted on different URLs? If so you could just create a single web reference and then either change it's type to dynamic (from the properties window) which will allow you to edit the .config file and specify a url. Alternatively you could just set the URL property of the webservice at runtime to the correct service. Generally speaking I would also suggest turning Option Strict On for VB projects and avoiding late binding altogether if possible. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.