简体   繁体   English

适用于基于Java的网站的iPhone应用程序

[英]iPhone app for a Java based website

I have a website which is developed using Java/Spring. 我有一个使用Java / Spring开发的网站。 We are about to develop an iphone application for the same. 我们将为此开发一个iphone应用程序。 How do we make the phone communicate with the web application? 我们如何使电话与Web应用程序通信? 1) Use http get/post from objective c 2) Create web services for all the features provided (each user action) and then call those from objective c. 1)使用来自目标c的http get / post 2)为提供的所有功能(每个用户操作)创建Web服务,然后从目标c调用这些功能。

Any thoughts on the above or better ways to do this? 对以上或更好的方法有什么想法?

I would use some form of web service. 我会使用某种形式的Web服务。 It's the easiest way to ensure that any future applications can also speak to the server without rewriting things yet again. 这是确保任何将来的应用程序也可以与服务器对话而不用再次重写的最简单方法。 For example, what happens when you want to release a Windows Mobile app, or an Android app down the road? 例如,当您要发布Windows Mobile应用程序或即将发布的Android应用程序时会发生什么? Plus, with modern tools and frameworks, it's pretty easy to write a web service, and easy to consume it on the client side. 另外,借助现代工具和框架,编写Web服务非常容易,并且很容易在客户端使用它。 That makes more sense than overcomplicating things with something not quite as standard. 这比使事情复杂化而不是使标准不完全有意义。

If you already have full support for http get/post you will be able to use that fairly easily on the iPhone. 如果您已经完全支持http get / post,则可以在iPhone上轻松使用它。 NSMutableHTTPURLRequest through NSURLConnection is how you do a post. 通过NSURLConnection的NSMutableHTTPURLRequest是您执行帖子的方式。

It also depends on the nature of the data your are sending and returning. 它还取决于您发送和返回的数据的性质。 If the posts or responses are complex data structures, then using web services will package those up nicely. 如果帖子或回复是复杂的数据结构,则使用Web服务可以很好地打包它们。 If you already have xml or json, or are just passing around blocks of text, then web services is not needed. 如果您已经有了xml或json,或者只是传递文本块,则不需要Web服务。

http get/post is web service. http get / post Web服务。

if by web service you meant these complicated ws-* crap, don't. 如果通过web service表示这些复杂的ws- *废话,那就不要。 especially on a phone. 特别是在手机上

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM