android - How to call multiple webservices in the same activity -
i new android , working on calling multiple web services in 1 activity in different asynctask. if call 2 web services in same activity gives me server connection not close. how can handle it?
private class asynpickfromfavrt extends asynctask<void, void, void> { private final progressdialog dialog = new progressdialog(specifypickupplace.this); protected void onpreexecute() { this.dialog.setmessage(""); this.dialog.setindeterminate(false); this.dialog.setcancelable(false); this.dialog.show(); } protected void doinbackground(final void... unused) { retrivefavrt(user_id); return null; } protected void onpostexecute(void result) { if (this.dialog.isshowing()) { this.dialog.dismiss(); } } private string retrivefavrt(string user_id) { soapprimitive resultstring = null; soapobject request = new soapobject(namespace, method_name_2); request.addproperty("user_id", 1); soapserializationenvelope soapenvelope = new soapserializationenvelope(soapenvelope.ver11); soapenvelope.dotnet = true; soapenvelope.setoutputsoapobject(request); httptransportse httptransport = new httptransportse(url); httptransport.debug = true; try{ httptransport.call(soap_action_2, soapenvelope); if (soapenvelope.bodyin instanceof soapfault) { string str= ((soapfault) soapenvelope.bodyin).faultstring; log.i("getting error in ws", str); } else { soapobject resultsrequestsoap = (soapobject) soapenvelope.bodyin; log.d("ws, errors", string.valueof(resultsrequestsoap)); et1.settext(resultsrequestsoap.tostring()); } } catch (socketexception ex) { et1.settext(ex.getmessage()); log.i("long...", "response ------ "+result); log.e("error : " , "error on soapprimitivedata() " + ex.getmessage()); ex.printstacktrace(); } catch (exception e) { log.e("error : " , "error on soapprimitivedata() " + e.getmessage()); e.printstacktrace(); } return result2; } }
if call code gives me error server connection not closed.its current connection still open. how can resolve this? kindly me.
Comments
Post a Comment