title: developing android application with server using web service
body: <p>I am developing client/server apps (the client is an Android application which sends data to the server). I am developing the server using Java. I already connected the sever application "using NetBeans" using SQL Navigator 5.5. I want to use Json as a middle ware, but I don't know how! What is the most suitable, XML or Json? Do i need to use HTTP? If so, how (as I want to be able to secure the application)?</p>
  
  <p>The other thing that the server should respond to is the Android application by sending "longitude and latitude", for which Android should "geocode" and display on the form of map "location." Also, I <strong>need</strong> to understand more about the concept of web service that should work on the application.</p>
  
  <p>This is the server code:
  (The values that the server should get from the client are "long and lat")
  /*
   * To change this template, choose Tools | Templates
   * and open the template in the editor.
   */</p>
  
  <pre><code>package pkg;
  
  import java.sql.Connection;
  import java.sql.ResultSet;
  import java.sql.Statement;
  import javax.jws.WebService;
  import javax.jws.WebMethod;
  import javax.jws.WebParam;
  
  
  @WebService(serviceName = "lbsws")
  public class lbsws {
  
      /** This is a sample web service operation */
      @WebMethod(operationName = "hello")
      public String hello(@WebParam(name = "name") String longg) {
  
  
          String result=null;
          try
          {
  
  
  
          Connection con = dbConnection.getdbConnection("system","lbs","orcll", "localhost");
          Statement st = con.createStatement(); 
  
  
          String lat ="10";
  
          String query="select longg,lat,abs(("+longg+"-longg))/abs(("+lat+"-lat)) as function1 from lbs where abs(("+longg+"-longg))/abs(("+lat+"-lat)) = ("+
          "select min(abs(("+longg+"-longg))/abs(("+lat+"-lat))) from lbs)";
  
          ResultSet rs = st.executeQuery(query);
          while(rs.next())
          {
              result = rs.getFloat("longg")+","+ rs.getFloat("lat")+"-"+ rs.getFloat("function1");
          }
          }
          catch(Exception e)
          {
              System.out.println(e.toString());
          }
          return result;
      }
  
  }
  </code></pre>