Erik Porter (gravatar)

SmartPhone WebService Development with the Emulator

Ok, so I'm really more of a rich client kind of guy.  Give me some Windows Forms, heck...even give me some ASP.NET.  But even I have to admit that it is damn cool to access data across the country or even across the world through the air from your mobile phone or pocket pc.

So I dive right into the SmartPhone 2003 SDK and start making another front end for a little project I'm doing on the side.  I already have a Web Service setup that my Windows Forms Smart Client calls so I figured it would be easy to setup a cool little phone app to do a scaled down version of the same thing (more details coming later when I get closer to the beta stages of this little project).  I design a couple screens, slap in a little code here and there, etc.  Then, I go make a Web Reference so I can call my WebService and bring it all together.  I run the app...waiting...waiting, no dice...  The WebService Proxy returns back that it can't connect to my WebService.  I try a couple things, again, no go!

I head over to MSDN to see if the SmartPhone emulator can even connect to the internet.  I know at work when I worked on a PocketPC app that the plugged in PocketPC I was working with could tunnel through my machine out to the internet, so why can't the emulator?  I hit up microsoft.public.smartphone.developer and after a bit of searching (the search was actually useful on a Microsoft site...man, times are a changin'  ;)) and there it is...the answer.  Just so I don't forget and maybe to also help out a few needy souls, here's the answer:

  1. Go to Settings, then Data Connections (Shortcut: L, 8, 9, 2).
  2. Change Work Connection to NetCard (Is that short for Network Card?  Who knows?  *shrug*).
  3. Click Done.
  4. Go into Internet Explorer (Shortcut: L, 4).
  5. Click Menu, then Options (Shortcut: R, 7).
  6. Uncheck Automatically detect settings.
  7. Change Select Network to Work.
  8. Click Done.

You can now browse around with IE and your WebService calls will now work as expected.  Well, almost...remember that when adding your Web Reference for the name of the server, use the name of your local development machine, not "localhost".  The emulator doesn't get that when you say localhost, you really mean your machine.  When are computers going to start thinking like me?  Sheesh!

I guess I understand why this ability to get out to the internet isn't turned on by default.  Microsoft's big push for "Secure by Default" is great, don't get me wrong, but when it makes everything ten times harder, I really start having a problem with it.  Why isn't there just a simple menu option on the emulator to just turn internet accessibility on/off?  Something so we newbies don't have to scour Google almost as much time in a day as we actually write code?

Well anywho, it's figured out and another 22.38 minutes of my life has been wasted yet again, but I'm a happy camper once more...back to coding...

2 Comments

  • http:// (gravatar)

    http:// said
    March 18, 2007

    I have followed your instructions but without success. Is there something else to check ? Thanks

    dasluna@gmail.com

    I can access the Internet from the Pocket PC emulator, but no way from the SmartPhone emulator

  • http:// (gravatar)

    http:// said
    September 02, 2008

    hi!
    I have an assignment due on friday 5/09 on a smartphone...its a very simple application cos we just started the section. It just has basic softkey functions to change the wallpaper on the form.
    My problem is that we also have to include a web service in the project....how do i do that?
    I've added a Google web reference to my solution but now I'm stuck! It doesnt have to be complicated, as long as it works!
    Please email me ASAP if you know what i should do!
    My address is aradhna452@gmail.com.

    Thanks!

Your Information
Mrs. Gravatar (gravatar)

<-- It's a gravatar

your comment