Need to access an xml file over https by accepting all certs in android

icemaid1979

New Member
I have just began programming in android and I am using a code to retrieve an xml file from a https encrypted server.\[code\]public String getXmlFromUrl(String url) { String xml = null; try { DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(url); HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); xml = EntityUtils.toString(httpEntity); Log.w(TAG,"xml recieved"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } // return XML return xml;}\[/code\]I have read articles telling me about \[code\]SSLScoketFactory\[/code\] and trust manager and all. Its very confusing. Can anyone tell me what or how I should proceed now? I am not worried about man in the middle attacks. I just need to retrieve the xml file.Thanks.
 
Back
Top