Awesome
##DISCLAIMER
This library is still under construction. Beta testers are more than welcome.
PICO
A light Web Service client framework targeting iOS platform.
Feature Highlight
- Support WSDL driven development, code generator tool is provided to auto-genearte strongly typed proxy from WSDL.
- Support SOAP 1.1/1.2 and XML based web service.
- Support automatic SOAP/XML to Objective-C object binding, performance is better than iOS native XML parser.
- Built on popular and mature AFNetworking library for iOS.
- Has been verified with industrial level Web Service like Amazon ECommerce Web Serivce and eBay Finding/Shopping/Trading Web Service.
- Support asychronous service invocation, flexible HTTP/SOAP header setting, timeout setting, encoding setting, logging, etc.
The Big Picture
Adding Pico to Your Project
You have a few options:
####Include the whole Pico source in your project If you use this option, make sure:
- In Target Build Setting, add the
-ObjC
flag to your "Other Linker flags". - In Target Build Setting, add
/usr/include/libxml2
to your "Header Search Paths" - In Target Build Phases, link binary with library
libxml2.dylib
####Add Pico xcodeproj to your project/workspace and reference Pico as a static library If you use this option, make sure:
- In Target Build Setting, add the Pico source path to your "User Header Search Paths", choose "recursive" search path.
- In Target Build Phases, link binary with library
libxml2.dylib
- In Target Build Phases, link binary with library
libPico.a
- You might also need to add Pico to the Traget Dependencies list.
##WSDL Driven Development Flow
- Genearte Objective-C proxy from WSDL
- Create new iOS project, add Pico runtime and generated proxy into your project
- 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] autorelease];
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
- eBayFinding - Hello world like sample using eBay Finding API SOAP call.
- eBayShopping - Hello world like sample using eBay Shopping API XML call.
- AWSECommerce - Hello world like sample using Amazon Product Advertising API SOAP call.
- eBayDemoApp - Sample eBay Search App using both eBay Finding API and eBay Shopping API.
- AWSECDemoApp - Sample Amazon Book search and purchase app using Amazon Product Advertising API.
##Docs
- Wsdl Driven Development on iOS - the Big Picture
- Pico Tutorial 1 - A StockQuote Sample
- Pico Tutorial 2 - A CurrencyConverter Sample
- Pico Tutorial 3 - Hello eBay Finding Service
- Pico Tutorial 4 - Hello eBay Shopping Service
- Pico Tutoiral 5 - Hello Amazon Product Advertising API
- Pico and eBay Trading API integration How To
- Easy Web Service on iOS with Pico[ppt]
##Mapping between XML Schema Types and Objective-C Types
<table> <tr><th>XML Schema Data Types</th><th>Objective-C Data Types</th></tr> <tr> <td>xsd:base64Binary</td> <td>NSData</td> </tr> <tr> <td>xsd:boolean</td> <td>NSNumber with bool value</td> </tr> <tr> <td>xsd:byte</td> <td>NSNumber</td> </tr> <tr> <td>xsd:date</td> <td>NSDate</td> </tr> <tr> <td>xsd:dateTime</td> <td>NSDate</td> </tr> <tr> <td>xsd:decimal</td> <td>NSNumber with double value</td> </tr> <tr> <td>xsd:double</td> <td>NSNumber with double value</td> </tr> <tr> <td>xsd:duration</td> <td>NSString</td> </tr> <tr> <td>xsd:float</td> <td>NSNumber with float value</td> </tr> <tr> <td>xsd:g</td> <td>NSDate</td> </tr> <tr> <td>xsd:hexBinary</td> <td>NSData</td> </tr> <tr> <td>xsd:int</td> <td>NSNumber with int value</td> </tr> <tr> <td>xsd:integer</td> <td>NSNumber with long value</td> </tr> <tr> <td>xsd:long</td> <td>NSNumber with long value</td> </tr> <tr> <td>xsd:NOTATION</td> <td>NSString</td> </tr> <tr> <td>xsd:Qname</td> <td>NSString</td> </tr> <tr> <td>xsd:short</td> <td>NSNumber with short value</td> </tr> <tr> <td>xsd:string</td> <td>NSString</td> </tr> <tr> <td>xsd:time</td> <td>NSDate</td> </tr> <tr> <td>xsd:unsignedByte</td> <td>NSNumber with short value</td> </tr> <tr> <td>xsd:unsignedInt</td> <td>NSNumber with long value</td> </tr> <tr> <td>xsd:unsignedShort</td> <td>NSNumber with int value</td> </tr> </table>##Compatibility
- Pico 0.5 and higher requires iOS 4.0 and above.
- ARC(Automatic Reference Counting) is not supported yet
Version History
0.5.0 — March 25, 2013
- Initial version:)
##Current Limitation
- ARC(Automatic Reference Counting) is not supported yet.
- Only Document/Literal style Web Service is support, RPC style Web Serivice is not supported.
- SOAP attachment is not supported
##Related project
- Pico proxy for Amazon Product Advertising API
- Pico proxy for eBay Finding API
- Pico proxy for eBay Shopping API
- Pico proxy for eBay Trading API
##Copyright and License (The MIT License)
Copyright (c) 2013 Leansoft Technology 51startup@sina.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.