Install Fink on Mac OS X 10.6 from source "following these instructions":http://www.finkproject.org/download/srcdist.php (there is no binary installer available for Snow Leopard at the time of this writing).

November 8, 2011 · View on GitHub

h1. iPhone Web Services Consumption Comparison

h2. Introduction

This project showcases different transport formats and libraries to consume web services from an iPhone application. It features a server application, a command-line script that saves the output of the server application in different formats, and an iPhone client application (compatible with iPhone OS 3.0 and higher).

The server application (written in PHP) reads a MySQL database (Server/data/schema.sql) and outputs data in the following formats:

  • HTML
  • JSON
  • YAML
  • XML (arbitrary format)
  • SOAP
  • Property list ** Binary property list ** XML property list
  • CSV
  • Protocol Buffer (Google)

For each output format, there is a single "Formatter" subclass in the Server/formatters folder. A static method in the FormatterFactory class returns the formatter that corresponds to the requested output format.

h2. Future Extensions

In future versions of this project, the following formats and libraries could be integrated:

h2. Libraries Used

The project uses several different libraries:

For the server:

For the iPhone client:

h3. YAML in Cocoa

For parsing YAML in Cocoa, the code in "this page":http://will.thimbleby.net/yaml.html was adapted, removing dependencies on the Cocoa AppKit framework (not available on the iPhone).

If you want to compile the YAML::Syck library with Fink, follow these steps:

Install Fink on Mac OS X 10.6 from source "following these instructions":http://www.finkproject.org/download/srcdist.php (there is no binary installer available for Snow Leopard at the time of this writing).

Type "/sw/bin/fink install syck" to install syck.

The Xcode project should now compile without problems.

To avoid these steps above, this project includes a version of libsyck.a already compiled as a "fat binary" format for both ARM (iPhone OS) and Intel (Simulator) processors.

h3. SOAP in Cocoa

The "wsdl2objc":http://code.google.com/p/wsdl2objc/ tool was used to generate Objective-C (Cocoa) code from the server's WSDL. This code was later adapted to parse the array returned by the server.

h2. Installation

Set up the server:

Upload the "Server" folder contents via FTP or other means.

Create a MySQL database.

Import the "Server/data/schema.sql" file into the database. This will create a "data" table in the database.

Change the settings in the "Server/data/database.php" file to access the database (server, username, password).

Set up the client:

Open the "Client/Client.xcodeproj" project in Xcode.

Compile the project.

Execute the client, which will connect to your server and retrieve data.

If required, change the URL of the remote data tapping the "Settings" button in the interface.

h2. Other Links

The application icon and splash screen have been adapted from "this picture":http://www.eee.bham.ac.uk/com_test/img\dsnl\internet15jan06.png.

h2. License

This project is released with a liberal BSD license. See the LICENSE file for details.