简体   繁体   中英

Does iPad development work with interacting through Java code with Spring Framework using TomCat to host the web service on a server? How?

Here is the background of my situation:

I want to create an iPad application that interacts with a oracle SQL database. I have existing Java code from my Flex application that handles all the database requests, and modifications using the Spring Framework. The Flex Application ran as a web service through TomCat. Now I want to make that flex application into a mobile iPad version. I am having trouble figuring out what is the easiest way to use existing Java code and use it for the iPad because the iPad interacts using URL requests instead of direct with the Java.

My question is, can I use the existing Java code with the Spring framework to save time from coding all the back-end handling? Basically I want to access all the classes from my Java code by doing Requests from the iPad. Is this possible and will I need JSON or XML to interact between the iPad and the Java code?

Summary:

Can I use

iPad Objective-C <-----> Java (with spring framework) on TomCat Web Service to handle oracle SQL data handeling? If so, how and what technologies do I need? Will I need JSON or XML and how does that factor between the iPad and Java?

Thanks!

A good approach would be to design your app to communicate with RESTful services that return JSON. Once this is done your iPad app doesn't have to even know that the server code is written in Java.. it's just interacting over HTTP.

Here's a good tutorial on setting up your tomcat to host your RESTful services: http://www.vogella.com/articles/REST/article.html - I've used this for an app I'm developing. Spring isn't even necessary.

You could go XML, but JSON is just easier in my opinion. Here's a good blog outlining the good and bad of both sides. http://digitalbazaar.com/2010/11/22/json-vs-xml/

OK, I'm making the following presumptions.

  1. Your flex application runs on a different machine from the Tomcat server
  2. Your flex application makes web service calls to the Tomcat server

So, the flex application doesn't know the underlying technology that provides the web services. It's just seeing/consuming the output

There's no reason why the iPad app can't do the same thing. There's no reason why it can't use the same web services that the Flex application uses. It could consume the same messages (Assuming it can handle the request/response format currently employed by the Flex application).

You can make changes if you like if you want to change the structure of the requests/responses between the clients. But the clients don't know (nor care) how the web services are implemented. They are just requesting and consuming info.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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