Hello,
I am having web service in asp.net and want to ask that how to call this service in android I tried SOAP connection but getting an issue regarding ksoap header. I want to call web service and I am getting response in xml format. Please help me on this.
Loading
RanoPosted Jun 14, 2013, 8:00 AM
http://articlesforprogramming.blogspot.in/2013/06/consume-net-webservice-in-android-using.html
Chintan RathodPosted Mar 5, 2013, 11:59 AM
HttpPost httppost = new HttpPost(BASE_URL);
httppost.setHeader("User-Agent", "YourApplication");
HttpParams httpParameters = new BasicHttpParams();
int timeoutConnection = 1000 * 30;
HttpConnectionParams.setConnectionTimeout(httpParameters,
timeoutConnection);
int timeoutSocket = 1000 * 30;
HttpConnectionParams.setSoTimeout(httpParameters, timeoutSocket);
httpClient = new DefaultHttpClient(httpParameters);
ArrayList
nameValuePairs.add(new BasicNameValuePair("key","value"));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpClient.execute(httppost);
StatusLine statusLine = response.getStatusLine();
if (statusLine.getStatusCode() == HttpStatus.SC_OK) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
response.getEntity().writeTo(out);
out.close();
String responseString = out.toString();
return responseString;
}
else {
// Closes the connection.
response.getEntity().getContent().close();
throw new IOException(statusLine.getReasonPhrase());
}
Hope this will help you.