A few weeks ago I presented at the Mobile Technology for Teaching & Learning. My talk was how to leverage service-oriented-architecture and objective-c runtime functionality in your enterprise applications. In my demo app I had two json files to use as my datasource so that I wouldn't have to rely on an internet connection.
*I was glad that I did because I had lots of problems with it.
After that talk was over I pushed all the code to github with the goal of modifying the project to use an actual web service to show a real world example of how it works. In order to do that I needed to first create the web service. Up to this point in my development career I have been using PHP for the service layer with CouchDB as the datastore. With this particular project I wanted to take things in a different direction. A few years ago I started tinkering with Python and have really grown to love the language. Unfortunately, I haven't been in a situation to were I could use it in any project beyond a few helper scripts (mainly because of me being a novice and my tight time constraints). I wasn't bound by these restrictions for this project. What I wasn't looking forward to was doing the server side, "infrastructure" setup to get things going. I wanted to focus on the development.
Enter Google App Engine to the rescue! Setting up an account and application with GAE is out of the scope of this post, but Google makes it very easy to do…especially if you are focusing on Python. I knew that scaling wouldn't be an issue nor would the data integrity. Google is somewhat good at both of those.
I was able to hack out a basic web service within a day.
My biggest roadblock came with handling class instances into JSON. The awesome community of stackoverflow.com had it covered.
The demo app is modified to use these endpoints for data via GCD. I also added a class extension for NSDictionary that simplifies the JSON parsing logic, thus removing a lot of the boilerplate code that I had in there originally.
I will be adding in some more enhancements and abstracting the code over the next few weeks. As always, if you have any comments or suggestions please don't hesitate to contact me.