I am making a http post request within an android application for using a soap web service method. When the request content data gets bigger in size, the execution of http post request pause at run time (on the line "response=httpclient.execute(httppost);") until exception occurs with message "java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer)". And i cannot get any response from web service.
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(wsUrl);
HttpResponse response;
try {
...
// variable soapMsg is constructed
httppost.setEntity(new StringEntity(soapMsg, "UTF-8"));
httppost.addHeader("SOAPAction", SOAP_ACTION);
httppost.addHeader("Content-Type", "text/xml; charset=utf-8");
response = httpclient.execute(httppost);
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
// Get hold of the response entity
HttpEntity entity = response.getEntity();
if (entity != null) {
InputStream instream = entity.getContent();
String result = Utilities.convertStreamToString(instream);
instream.close();
return result;
}
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
The problem occurs only on android devices, works on emulator with success.
What can be the reason of that problem? Thanks in advance...