How to parse json data from https client in android
- by Madhan Shanmugam
I try to fetch data from https client. Same code i used to fetch from http client. but its working fine. when i try to use Https client its not working. i am getting the following error.
java.net.UnknownHostException: Host is unresolved: https client address:443
Error Log:
10-27 10:01:08.280: W/System.err(21826): java.net.UnknownHostException: Host is unresolved: https client address.com 443
10-27 10:01:08.290: W/System.err(21826): at java.net.Socket.connect(Socket.java:1037)
10-27 10:01:08.290: W/System.err(21826): at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:317)
10-27 10:01:08.310: W/System.err(21826): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:129)
10-27 10:01:08.310: W/System.err(21826): at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
10-27 10:01:08.310: W/System.err(21826): at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
10-27 10:01:08.310: W/System.err(21826): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:348)
10-27 10:01:08.310: W/System.err(21826): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
10-27 10:01:08.320: W/System.err(21826): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
10-27 10:01:08.320: W/System.err(21826): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
10-27 10:01:08.320: W/System.err(21826): at com.myfile.JSONParser.getJSONFromUrl(JSONParser.java:38)
10-27 10:01:08.320: W/System.err(21826): at com.myfile.myfile.processThread(myfile.java:159)
10-27 10:01:08.330: W/System.err(21826): at com.peripay.PERIPay$1$1.run(myfile.java:65)
10-27 10:01:08.330: E/Buffer Error(21826): Error converting result java.lang.NullPointerException
10-27 10:01:08.330: E/JSON Parser(21826): Error parsing data org.json.JSONException: A JSONObject text must begin with '{' at character 0 of