开发者

iPhone application talking to a web service, the basics

We have an iPhone application created by an external consultancy that we're planning to add card payment facilities t开发者_StackOverflowo in a subsequent release.

We plan to host a service ourselves in order to process the payment stuff, with SSL encryption. We have in-house expertese for all of this apart from the (contracted out) iPhone bit.

Are there any specific gotchas that we should be aware of that concern designing web services for iPhones?

We'll be writing the web service in C# 3.5.


JSON data format is better to be converted into NSArray or NSDictionary objects. It's easier and faster to be parsed.

So, specifically for the iPhone, it's a lot better to consume JSON data. Unless if there's some technical complexity that JSON is unable to handle.

Check YAJL:

http://github.com/lloyd/yajl

There are Objective-C wrapper/implementations by gabriel in github and by MGTwitterEngine.

TouchJSON is another code that's simpler than yajl. You can convert JSON string into NSDictionary or NSArray object in 2 lines of code. But, it maybe slower.


I'm not sure there are really any special considerations. The iPhone should be able to communicate with most types of webservice.

I worked on an iPhone app that communicated to a RESTful webservice written in Java.

I imagine it's pretty straightforward across the board - there are plenty of libraries for parsing/generating XML or JSON formatted messages, the iPhone can handle HTTP authentication, HTTPS, caching, etc.

It's just down to your iPhone developer to get it right :)


For SOAP based web services I strongly suggest that you try gSOAP. This library does not support Objective-C, however it supports C and C++ and is certainly the most complete open source project to access SOAP based web service; it also outperforms all of the other libraries.

For Objective-C you may want to try wsdl2objc, but I am not sure if it provides support for SSL/TLS (gSOAP does).

Finally, REST based web services are easily handled using ASIHTTPRequest.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜