Latest 0.7.2
Homepage https://github.com/maxep/PicoKit
License MIT
Platforms ios 7.0, osx 10.9, requires ARC
Authors ,

CI Status
Version
License
Platform

A light Web Service client framework targeting iOS platform.

Note

PicoKit is initially a fork of pico.

Pico (and related projects: mxjc, mwsc & nano) has been developed by bulldog2011 but stayed as is from 2013. As it is very well designed and implemented, I decided to fork it and upgrade it to support ARC and be available through CocoaPods.

Feature Highlight

  1. Support WSDL driven development, code generator tool is provided to auto-genearte strongly typed proxy from WSDL.
  2. Support SOAP 1.1/1.2 and XML based web service.
  3. Support automatic SOAP/XML to Objective-C object binding, performance is better than iOS native XML parser.
  4. Built on popular and mature AFNetworking library for iOS.
  5. Has been verified with industrial level Web Service like Amazon ECommerce Web Serivce and eBay Finding/Shopping/Trading Web Service.
  6. Support asychronous service invocation, flexible HTTP/SOAP header setting, timeout setting, encoding setting, logging, etc.

The Big Picture

The Big Picture

Installation

PicoKit is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'PicoKit'

Old fashioned way:

Include the whole Pico source in your project. If you use this option, make sure:

  1. In Target Build Setting, add the -ObjC flag to your "Other Linker flags".
  2. In Target Build Setting, add /usr/include/libxml2 to your "Header Search Paths"
  3. In Target Build Phases, link binary with library libxml2.dylib

WSDL Driven Development Flow

  1. Generate Objective-C proxy from WSDL
  2. Create new iOS project, add PicoKit and generated proxy into your project
  3. Implement appliction logic and UI, call proxy to invoke web service as needed.

Example Usage

After the service proxy is generated from wsdl, service invocation through Pico runtime is extremely easy:


        // start progress activity
        [self.view makeToastActivity];

        // Get shared service client
        StockQuoteServiceClient *client = [StockQuoteServiceClient sharedClient];
        client.debug = YES; // enable request/response message logging

        // Build request object
        GetQuote *request = [[GetQuote alloc] init];
        request.symbol = _symbolText.text;

        // make API call and register callbacks
        [client getQuote:request success:^(GetQuoteResponse *responseObject) {

            // stop progress activity
            [self.view hideToastActivity];

            // show result
            _resultText.text = responseObject.getQuoteResult;
        } failure:^(NSError *error, id<PicoBindable> soapFault) {

            // stop progress activity
            [self.view hideToastActivity];

            if (error) { // http or parsing error
                [self.view makeToast:[error localizedDescription] duration:3.0 position:@"center" title:@"Error"];
            } else if (soapFault) {
                SOAP11Fault *soap11Fault = (SOAP11Fault *)soapFault;
                [self.view makeToast:soap11Fault.faultstring duration:3.0 position:@"center" title:@"SOAP Fault"];
            }
        }];

Sample List

All samples are in the Examples folder, following samples are included:

  • StockQuote – Demo app using StockQueue SOAP web serivce from webserviceX.NET.
  • CurrencyConverter – Demo app using CurrencyConverter SOAP web service from webserviceX.NET.
  • BarCode – Demo app using BarcodeGenerator SOAP web serivce from webserviceX.NET
  • Weather – Demo app using Weather SOAP web serivce from wsf.cdyne.com
  • AWSECommerce – Hello world like sample using Amazon Product Advertising API SOAP call.
  • AWSECDemoApp – Sample Amazon Book search and purchase app using Amazon Product Advertising API.
  • eBayFinding – Hello world like sample using eBay Finding API SOAP call.
  • eBayShopping – Hello world like sample using eBay Shopping API XML call.
  • eBayDemoApp – Sample eBay Search App using both eBay Finding API and eBay Shopping API.

Documentation

  1. Wsdl Driven Development on iOS – the Big Picture
  2. Pico Tutorial 1 – A StockQuote Sample
  3. Pico Tutorial 2 – A CurrencyConverter Sample
  4. Pico Tutorial 3 – Hello eBay Finding Service
  5. Pico Tutorial 4 – Hello eBay Shopping Service
  6. Pico Tutoiral 5 – Hello Amazon Product Advertising API
  7. Pico and eBay Trading API integration How To
  8. Easy Web Service on iOS with Pico[ppt]

Mapping between XML Schema Types and Objective-C Types

XML Schema Data Types Objective-C Data Types
xsd:base64Binary NSData
xsd:boolean NSNumber
xsd:byte NSNumber
xsd:date NSDate
xsd:dateTime NSDate
xsd:decimal NSNumber
xsd:double NSNumber
xsd:duration NSString
xsd:float NSNumber
xsd:g NSDate
xsd:hexBinary NSData
xsd:int NSNumber
xsd:integer NSNumber
xsd:long NSNumber
xsd:NOTATION NSString
xsd:Qname NSString
xsd:short NSNumber
xsd:string NSString
xsd:time NSDate
xsd:unsignedByte NSNumber
xsd:unsignedInt NSNumber
xsd:unsignedShort NSNumber

Version History

Version Date Description
0.5.0 March 25, 2013 Initial version
0.6.0 April 8, 2015 ARC & CocoaPods support
0.6.1 April 10, 2015 ARC & CocoaPods support
0.7.0 August 10, 2015 Upgrade to AFNetworking 2.5.4
0.7.1 September 29, 2015 Upgrade to iOS9 & AFNetworking 2.6.0
0.7.2 October 27, 2015 Upgrade to GDataXML-HTML 1.3.0

Current Limitation

  1. Only Document/Literal style Web Service is support, RPC style Web Serivice is not supported.
  2. SOAP attachment is not supported

Related project

  1. Pico proxy for Amazon Product Advertising API
  2. Pico proxy for eBay Finding API
  3. Pico proxy for eBay Shopping API
  4. Pico proxy for eBay Trading API

License

PicoKit is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "PicoKit",
    "version": "0.7.2",
    "summary": "A light Web Service client framework targeting iOS platform.",
    "homepage": "https://github.com/maxep/PicoKit",
    "authors": {
        "William Yang": "http://bulldog2011.github.io/",
        "Maxime Epain": "http://maxep.github.io/"
    },
    "social_media_url": "https://twitter.com/MaximeEpain",
    "source": {
        "git": "https://github.com/maxep/PicoKit.git",
        "tag": "v0.7.2"
    },
    "license": "MIT",
    "default_subspecs": "WebService",
    "libraries": "xml2",
    "xcconfig": {
        "HEADER_SEARCH_PATHS": "$(SDKROOT)/usr/include/libxml2"
    },
    "requires_arc": true,
    "platforms": {
        "ios": "7.0",
        "osx": "10.9"
    },
    "subspecs": [
        {
            "name": "Core",
            "source_files": [
                "Pod/Core",
                "Pod/Core/Converter",
                "Pod/Core/Cache",
                "Pod/Core/Schema",
                "Pod/Core/XMLSupport"
            ],
            "dependencies": {
                "PicoKit/XMLWriter": [],
                "PicoKit/OrderedDictionary": [],
                "GDataXML-HTML": [
                    "~> 1.3.0"
                ]
            }
        },
        {
            "name": "WebService",
            "source_files": "Pod/WebService",
            "dependencies": {
                "PicoKit/Soap": [],
                "AFNetworking": [
                    "~> 2.6.0"
                ]
            },
            "ios": {
                "frameworks": [
                    "CFNetwork",
                    "MobileCoreServices",
                    "SystemConfiguration"
                ]
            },
            "osx": {
                "frameworks": [
                    "CoreServices",
                    "SystemConfiguration"
                ]
            },
            "prefix_header_contents": "#import n#if __IPHONE_OS_VERSION_MIN_REQUIREDn  #import n  #import n#elsen  #import n  #import n#endif"
        },
        {
            "name": "Soap",
            "source_files": [
                "Pod/SOAP",
                "Pod/SOAP/SOAP11",
                "Pod/SOAP/SOAP12"
            ],
            "dependencies": {
                "PicoKit/Core": []
            }
        },
        {
            "name": "XMLWriter",
            "source_files": "Pod/XMLWriter"
        },
        {
            "name": "OrderedDictionary",
            "source_files": "Pod/OrderedDictionary"
        }
    ]
}

Pin It on Pinterest

Share This