title: how to consume json web service deployed in iis in android
body: <p>i have created restfull webservices (retun json data) in asp.net and deploye it on iis.now i want to consume that webServices in android..but in android its work fine in emulator but on android device its give error...</p>
  
  <p>Error: Connection to" //<a href="http://ipAddress.:6547/" rel="nofollow">http://ipAddress.:6547/</a>" refused
  plz help
  thats code</p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      // TODO Auto-generated method stub
      super.onCreate(savedInstanceState);
      setContentView(R.layout.recent_jsonws_map_layout);
  
  
  }
  
  
   public String readJSONFeed(String URL)
   {
          StringBuilder stringBuilder = new StringBuilder();
          HttpClient httpClient = new DefaultHttpClient();
          HttpGet httpGet = new HttpGet(URL);
          try
          {
              HttpResponse response = httpClient.execute(httpGet);
              StatusLine statusLine = response.getStatusLine();
              int statusCode = statusLine.getStatusCode();
              if (statusCode == 200)
              {
                  HttpEntity entity = response.getEntity();
                  InputStream inputStream = entity.getContent();
                  BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
                  String line;
                  while ((line = reader.readLine()) != null)
                  {
                      stringBuilder.append(line);
                  }
                  inputStream.close();
              }
              else
              {
                  Log.d("JSON", "Failed to download file");
              }
          }
          catch (Exception e)
          {
              Log.e("readJSONFeed", e.getLocalizedMessage());
          }        
          return stringBuilder.toString();
     }
  
  
   @SuppressWarnings("unused")
   private class ReadWeatherJSONFeedTask extends AsyncTask&lt;String, Void, String&gt;
   {
          protected String doInBackground(String... urls)
          {
              return readJSONFeed(urls[0]);
          }
  
          protected void onPostExecute(String result)
          {
              try
              {
                  jsonObject = new JSONObject(result);
                  jsonArrayGeoPoint = new JSONArray(jsonObject.getString("jsondataResult").toString());
                  Toast.makeText(getApplicationContext(), jsonArrayGeoPoint.getString(0).toString()+"||"+jsonArrayGeoPoint.getString(1).toString(), Toast.LENGTH_SHORT).show();
  
                  String[] strArrtemp=new String[5];
                  Double[] strArrLat = new Double[5];
                  Double[] strArrLon = new Double[5];
  
                  for(int i=0; i&lt;jsonArrayGeoPoint.length(); i++)
                  {
                      try
                      {
                          strArrtemp[i]=jsonArrayGeoPoint.getString(i).toString();
  
                      }
                      catch (JSONException e)
                      {
                          Log.e("JsonArray ERROR",e.getLocalizedMessage());
                      }
                  }
  
                  String[] arrytemp = new String[2];
                  String temp;
  
                  for(int i=0; i&lt;strArrtemp.length; i++)
                  {   
                      temp = strArrtemp[i].toString();
                      strArrLat[i]=Double.parseDouble(temp.substring(0,6));
                      strArrLon[i]=Double.parseDouble(temp.substring(7,13));
                  }
                  Toast.makeText(getApplicationContext(), "Lat1="+strArrLat[1].toString()+" &amp; Lon1="+strArrLon.toString(), Toast.LENGTH_SHORT).show();
              Button getDir;
              getDir = (Button)findViewById(R.id.getLocationBtn);
              getDir.setText(strArrLat[1].toString());
  
  
              }
              catch (Exception e)
              {
                  Log.e("ReadWeatherJSONFeedTask", e.getLocalizedMessage());
              }          
          }
   }
  
  
  
  
  
  enter code here
  
  
   public void btnGetWeather(View view)
   { newReadWeatherJSONFeedTask().execute(http://ipAddress.:6547/RestServiceImpl.svc/jsondata/");
   }
  </code></pre>
  
  <p>}</p>