Skip to content
This repository has been archived by the owner on Oct 5, 2018. It is now read-only.

This project showcases different transport formats and libraries to consume web services from an iOS application.

License

Notifications You must be signed in to change notification settings

akosma/iPhoneWebServicesClient

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

iPhone Web Services Consumption Comparison

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.

Future Extensions

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

Libraries Used

The project uses several different libraries:

For the server:

  • cfpropertylist – A PHP Implementation Of Apple’s plist (PropertyList).
  • NuSOAPSOAP Toolkit for PHP.
  • spyc – A simple YAML loader/dumper class for PHP.
  • pb4php – Protocol Buffer for PHP

For the iPhone client:

  • AFNetworking – a very fast, NSOperation-based networking library
  • NextiveJSON – a very fast JSON parsing library
  • ASIHTTPRequest – wrapper around the CFNetwork API, no longer maintained
  • json-framework – A strict JSON parser/generator for Objective-C.
  • JSONKit – A Very High Performance Objective-C JSON Library.
  • YAJL-objc – Objective-C bindings for the YAJL parser.
  • BSJSON – A simple JSON parser in Objective-C.
  • touchcode – Repository of iPhone and iPod Touch source code.
  • cCSVParse – A CSV parsing library in Objective-C.
  • TBXML V1.3XML Parser by Tom Bradley.
  • KissXML – KissXML is a replacement for Cocoa’s NSXML cluster of classes. It is based on libxml.
  • TinyXML – TinyXML is a simple, small, C++ XML parser that can be easily integrating into other programs.
  • gdata-objectivec-clientXML support classes included in the Google Data APIs Objective-C Client Library.
  • APXML – NSXMLDocument ’substitute’ for iPhone/iPod Touch.
  • ProtocolBuffers – Objective-C Protocol Buffers for OSX and the iPhone.
  • AQXMLParser – Another parser for XML in Objective-C.
  • InAppSettingsKit – Library allowing to access the current setting bundle from the application.

YAML in Cocoa

For parsing YAML in Cocoa, the code in this page 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:

  1. Install Fink on Mac OS X 10.6 from source following these instructions (there is no binary installer available for Snow Leopard at the time of this writing).
  2. Type “/sw/bin/fink install syck” to install syck.
  3. 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.

SOAP in Cocoa

The 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.

Installation

  1. Set up the server:
    1. Upload the “Server” folder contents via FTP or other means.
    2. Create a MySQL database.
    3. Import the “Server/data/schema.sql” file into the database. This will create a “data” table in the database.
    4. Change the settings in the “Server/data/database.php” file to access the database (server, username, password).
  2. Set up the client:
    1. Open the “Client/Client.xcodeproj” project in Xcode.
    2. Compile the project.
    3. Execute the client, which will connect to your server and retrieve data.
    4. If required, change the URL of the remote data tapping the “Settings” button in the interface.

Other Links

The application icon and splash screen have been adapted from this picture.

License

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

About

This project showcases different transport formats and libraries to consume web services from an iOS application.

Resources

License

Stars

Watchers

Forks

Packages

No packages published