For Programmers: Free Programming Magazines  


Home > Archive > Smartphone Developer Forum > January 2005 > Having trouble changing a web service URL at runtime









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Having trouble changing a web service URL at runtime
Edward Fretwell

2005-01-23, 4:04 pm

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
Neil Enns [MSFT]

2005-01-23, 4:04 pm

Ed,

If you don't get an answer here, try asking over in
news:microsoft.public.dotnet.framework.compactframework. Someone there might
be able to assist.

Neil

--
Neil Enns
Program Manager
Microsoft Visual Studio for Devices

This posting is provided "AS IS" with no warranties, and confers no rights.
"Edward Fretwell" <Edward Fretwell@discussions.microsoft.com> wrote in
message news:3C7BA71C-F047-4BA0-A56A-36BF8E63F7B6@microsoft.com...
> 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



Edward Fretwell

2005-01-23, 4:04 pm


Thanks Neil, I'll give that a try.

"Neil Enns [MSFT]" wrote:

> Ed,
>
> If you don't get an answer here, try asking over in
> news:microsoft.public.dotnet.framework.compactframework. Someone there might
> be able to assist.
>
> Neil


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com