G
Guest
I'm playing with a simple smartphone app that communicates with a server
application on a PC when connected via ActiveSync.
The server app exposes a web service which I connect to in my client by
adding a web reference to the project and letting VS.Net generate a proxy
class for me. The web service is generated by setting up a .Net Remoting
channel because I don't want my app to require an IIS installation.
This works fine on my dev system, where the service address is always the
same as that used in the original web reference. However, if this is going to
be useable on any PCs other than mine, I want the user to be able to
configure the server URL at run time.
From what I can gather from MSDN, I'd expect this to be as simple as setting
the [proxyclass].Url property but this just causes the proxy class to throw a
NullReferenceException whenever I try to use it after setting the Url
property.
e.g.
- User starts Smartphone client app
- at this point, [proxyclass].Url == http://MyDevMachine:port/WebService
- An exception is thrown as the user doesn't have access to MyDevMachine
- This exception is caught and the user is prompted for an alternative
address
- User enters the correct address for their server.
- the client sets [proxyclass].Url to the address provided by the user
- at this point, I would expect the app to be able to use the webservice,
but whenever I call a webservice method on the proxy class, a
NullReferenceException is thrown.
Has anyone got any suggestions as to what I'm doing wrong? Or anywhere else
I should look?
Thanks,
Ed
application on a PC when connected via ActiveSync.
The server app exposes a web service which I connect to in my client by
adding a web reference to the project and letting VS.Net generate a proxy
class for me. The web service is generated by setting up a .Net Remoting
channel because I don't want my app to require an IIS installation.
This works fine on my dev system, where the service address is always the
same as that used in the original web reference. However, if this is going to
be useable on any PCs other than mine, I want the user to be able to
configure the server URL at run time.
From what I can gather from MSDN, I'd expect this to be as simple as setting
the [proxyclass].Url property but this just causes the proxy class to throw a
NullReferenceException whenever I try to use it after setting the Url
property.
e.g.
- User starts Smartphone client app
- at this point, [proxyclass].Url == http://MyDevMachine:port/WebService
- An exception is thrown as the user doesn't have access to MyDevMachine
- This exception is caught and the user is prompted for an alternative
address
- User enters the correct address for their server.
- the client sets [proxyclass].Url to the address provided by the user
- at this point, I would expect the app to be able to use the webservice,
but whenever I call a webservice method on the proxy class, a
NullReferenceException is thrown.
Has anyone got any suggestions as to what I'm doing wrong? Or anywhere else
I should look?
Thanks,
Ed