I need to do a Http post of some strings to a web service. I am using KSoap.
@Override
protected JSONObject doInBackground(JSONObject... params) {
String
You need to do the following troubleshooting:
i had sometimes same problem ... why? because time out in my case ... depends quantity of bytes are you downloading .... Because did you try a simple call to ws?is it works? =>> time out.
These errors often arise because the proxy failed to resolve a domain name into an address.
This problem is entirely due to slow IP communication between back-end computers, possibly including the Web server. Only the people who set up the network at the site which hosts the Web server can fix this problem.
I hope you are running operations on the user interface thread. Avoid that
For Android 2.3 (Gingerbread) and higher, the HttpUrlConnection is recommended instead of the HttpClient. See this Android team post: http://android-developers.blogspot.com/2011/09/androids-http-clients.html
It's possible that HttpClient is buggy on the device you're using and there are issues sending data over 3G.
Also, be sure to call this method before doing an HTTP request when using the HttpURLConnection:
private void disableConnectionReuseIfNecessary() {
// HTTP connection reuse which was buggy pre-froyo
if (Integer.parseInt(Build.VERSION.SDK) < Build.VERSION_CODES.FROYO) {
System.setProperty("http.keepAlive", "false");
}
}
You could try to connect to your server via the web browser of your phone to see if the problem is within your application or if the problem is a 3G problem resolving/connecting to the address of your server.
My guess is that you won't be able to connect either via a web browser.
Where is hosted your web service? Should it be accessible from an external network ? You may be able to connect to your server via wifi if the server is in the same network.