iphone application communicating with a java servlet on a WebSphere
Here is a Generic question:
I wish to build an iPhone application that will communicate with a Java Servlet installed in a webSphere, my iPhone application will ask the servlet to perform some SQL queries in the connected DB, and will receive the answers accordingly.
Pl开发者_如何学运维ease help to understand the following questions:
How should i send a request to the Java Servlet to perfrom the actions needed? (to operate the methods on the servlet?)
How should i receive the results back to my iPhone app? (Strings? XMLs?)
Any help will do.
I think the web service is the more standard way of doing this like SB said. But if you want to use a servlet instead you can pass in parameters to the URL eg
http://mysite.com/myservlet?parameter=inputdata
You could then call specific methods based on the parameters. Data can be returned by writing xml or csv directly into the response by calling HttpServletResponse.getWriter()
精彩评论