As soon as your boss gets an iPhone, he’ll ask you how to get to your corporate data from the road. The good thing is that you will need a Mac and an iPhone, but then you have to make it all happen. We focused on delivering a solution quickly that was very simple, scalable, and quick to market.

Specifically for us, we have corporate statistics that our executives wanted to be able to easily view from the road without having to turn on a laptop, search for wireless, log into our web app, navigate to the statistics page…you know the drill. . Instead, they should be able to pull out their iPhone and hit a ‘stats’ button. Boom! There are the statistics.

Many people are looking for the golden sample iPhone app that they can modify and they forget that a back-end infrastructure is required to feed that data to the requesting iPhone. To do that, you’re probably already thinking of a good web service that feeds back XML. SOAP comes to mind, but the current version of the iPhone SDK is light support. This is where most people will direct you to use REST. REST is great because it’s a URL-based requester, but it takes a lot of work to set it up.

Remember that “rapid time to market” is part of our goal, so why not consider the generic HTTP controller found in Visual Studio?

This is what you do:

1. Follow the example to create an RSS reader and connect it to your iPhone. Follow it word for word and it will work great. Here is the link: http://theappleblog.com/2008/08/04/tutorial-build-a-simple-rss-reader-for-iphone
2. Now in Visual Studio add a public generic controller. This will be an .ASHX file
3. in your SQL database, create a table that holds a relationship between username and iPhone ID
4. Edit the generic controller to support two parameters: one for the requested operation (in our case: statistics) and one for the iPhone ID.
5. if they are validated, respond with the statistics in XML using context.response
6. Test it in your browser by passing the correct parameters so you know it works before you start trying to access it from the iPhone.
7. Now adjust your iPhone app to use your new URL with parameters.

Once the basics work:

1. Create a corporate database table that holds the iPhone ID to User ID relationships and test it as the first operation on the controller. This makes the driver extremely safe because you cannot get past the front gate without a valid iPhone ID. By the way, we use UDID to get the addresses to use. You have to do this for ad-hoc provisioning anyway so you’re doubly covered.
2. create a register function that writes the date, time, user, iPhone and function to a table
3. improve iPhone app to allow drilldown capabilities (just another operation)

A couple of notes:

-this is scalable via the parameters passed.
-you can adjust the output to asp.net level instead of iPhone.
-This is very secure as only registered iPhones will get in.

Leave a Reply

Your email address will not be published. Required fields are marked *