This is a follow-up to a question that I posted a few months ago.
We have a WinForm interface that communicates with a Web Service, which in turn communicates with the middle-tier. We pass datasets back and forth for parameters, result sets, etc.
The Web server URL is configurable, and is defined/set at runtime. So I have a 'stub' web reference class that I created on my local drive that's part of the Winform app...but I need to redefine the URL at runtime to access the 'real' web server.
I received an answer that Adding a Web Reference generates a proxy class, with the contents of the Web Services WSDL file. In this proxy class, inside the New constructor, there's the service URL:
Public Sub New()
...
Me.Url = "
http://server/service/service.asmx"
End Sub
The problem is, I don't know specifically how to 'access' this. When I add the web reference, I can't seem to locate the proxy class where I can redefine the URL.
If I bypass all that, and try a ....
MyService.Service1 mytest = new MyService.Service1;
mytest.Url = "new url";
DsReturn = mytest.PerformRequest(DsRemoteInfo);
I get an error message..."object reference not set to instance of an object"
Now...if at design time, I explicitly add the 'real' web reference, it works fine. But I doubt I can do that in a production environment...yet when I add my 'stub' and then try to set the URL just prior to using it, I get the error I just described.
I'm sure I'm missing a step somewhere...so where specifically do I need to set the URL? By the way, I'm using C#, if that makes a difference.
Thanks,
Kevin