开发者

iPhone to Java EE remoting

I was looking for some opinions on the best remote method invocation practices when developing iPhone applications that communicate with Java (java EE) s开发者_开发知识库ervers.

Many iphone applications these days typically talk to a server back end. I typically prefer to write my servers in java using some Spring libraries. So far I have not found or stuck to a definitive practice for iphone->java server communication.

What are some technical solutions and libraries that you have used to implement this kind of client-server communication?

One thing I always keep in mind is that I want the communication protocols to be simple so that multiple platforms can be added for example, in future adding Android and possibly Blackberry clients, that can use the same protocol to talk to the server.


I'd go with JSON. If you want to use Spring, go with restful webservices. Do some googling on "webservices restful spring json" (without the quotes) and you'll get some pointers.

JSON will suit you fine with other languages as well. I've written an iPhone application that uses JSON, and that was quite easy with the use of http://code.google.com/p/json-framework. I'm pretty sure that both Android and Blackberry should be capable of reading JSON just fine as well.

Edit: I forgot to mention that I have put this iPhone application under an MIT license and you can browse the code on google code:

http://code.google.com/p/accountadmin/source/browse/#svn%2Ftrunk%2Fiphone%2FFrittRegnskap%2FClasses


I'm currently doing this for work as well. Our backend is Java EE (with Spring) and then of course the front end is iOS. We use JSON as the payload format, as Knubo suggested. All of our web services are also RESTful to make dealing with URL construction and authentication on the phone easier.

I would highly recommend you check out RestKit, which is a pretty comprehensive framework that allows you to easily integrate your RESTful, JSON-based web services with CoreData. We also use YAJL for parsing JSON manually in the rare cases where that is necessary.

Thus far, that tooling has made it a breeze to work with our web services.


http://code.google.com/p/json-framework is really useful.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜