Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

  • Administrators
Posted

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.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...