views:

85

answers:

1

Hello,

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.

Please help to understand the following questions:

  1. How should i send a request to the Java Servlet to perfrom the actions needed? (to operate the methods on the servlet?)

  2. How should i receive the results back to my iPhone app? (Strings? XMLs?)

Any help will do.

A: 

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()

James