我需要在Web服务上做一些字符串的Http帖子.我正在使用KSoap.
@Override
protected JSONObject doInBackground(JSONObject... params) {
String result;
HttpParams httpParameters = new BasicHttpParams();
// Set the timeout in milliseconds until a connection is established.
// The default value is zero, that means the timeout is not used.
int timeoutConnection = 30000;
HttpConnectionParams.setConnectionTimeout(httpParameters, timeoutConnection);
// Set the default socket timeout (SO_TIMEOUT)
// in milliseconds which is the timeout for waiting for data.
int timeoutSocket = 50000;
HttpConnectionParams.setSoTimeout(httpParameters, timeoutSocket);
HttpClient httpclient = new DefaultHttpClient(httpParameters);
setupClient(httpclient);
//HttpURLConnection httpclient = new HttpURLConnection(_url);
Log.d(TAG, …Run Code Online (Sandbox Code Playgroud)