Ok, here's my problem.
I have a web service referenced in my windows app and depending on what options the user selects when they log in, i need to change the url that the web service points to.
Before you can change the URL, you obviouslyneed to create an instance of the web service. The problem with this is that if the default url fails, then an exception is raised and the web service is not instantiated so i dont even get the chance to change the url.
My solution to this, was to go into the auto generated code file for the web service, and change its "New" function to require a URL parameter (which i pass it when i instantiate the web service in my code)
The problem with this, is that each time i update the web service i need to go in and make this change and its a hassle because i have a number of different web services which get updated regularly.
My next idea involved creating a custom service class, inheriting the web service, and overridding the Url property. The problem with that is that the Url property can not be overridden. So instead of using the'overrides' keyword, i used'shadows' instead (admittedly, not really knowing exactly whatthe difference was).
It looked ok... when i requested the URL property of my new class it returned the right value... but when it actually performed a request,it was performing it against the default URL. What can i do here? I am really sick of having to make these changes every time i update the web reference.
This is whatsaid custom class looked like;
Public Class Override_TakeFliteService
Inherits TakeFliteService.TakeFliteServices
Dim CustomHost As String
Public Sub New(ByVal CustomHostName As String)
MyBase.New()
Me.CustomHost = CustomHostName
End Sub
Public Shadows Property Url() As String
Get
If CustomHost = "" Then
Select Case ServerType
Case ServerTypes.Production
Return SetHostname(MyBase.Url, ProductionAddress)
Case Else
Return SetHostname(MyBase.Url, UATAddress)
End Select
Else
Return SetHostname(MyBase.Url, CustomHost)
End If
End Get
Set(ByVal value As String)
End Set
End Property
End Class