java - connect failed: ECONNREFUSED issue on few Anfroid Devices -
i have developed android application consumes webservice. have tested application on different devices , working on tablet of client, it's throwing exception. devices on application tested running android 6.0.1 marshmallow.following exception
java.net.connectexception: failed connect web.abc.com(port 80):connect failed: econnrefused (connection refused)
following code consuming webservice
string namespace = "http://web.abc.com/"; private static final string url = "http://web.abc.com/webservice/servicefilename.asmx"; string soap_action; soapobject request = null, objmessages = null; soapserializationenvelope envelope; httptransportse androidhttptransport; /** * set envelope */ protected void setenvelope() { try { // creating soap envelope envelope = new soapserializationenvelope(soapenvelope.ver11); //you can comment line if web service not .net one. envelope.dotnet = true; envelope.setoutputsoapobject(request); //envelope.addmapping(namespace, "productstausresponse",new productstausresponse().getclass()); androidhttptransport = new httptransportse(url); androidhttptransport.debug = true; } catch (exception e) { e.printstacktrace(); log.v("soap exception", e.tostring()); system.out.println("soap exception---->>>" + e.tostring()); } } // methodname variable define webservice function call public string getproductstatus(string methodname, string parameter) { try { productcode = productcode.trim(); soap_action = namespace + methodname; //adding values request object request = new soapobject(namespace, methodname); /// code setting properties setenvelope(); try { //soap calling webservice androidhttptransport.call(soap_action, envelope); //got webservice response string result = envelope.getresponse().tostring(); return result; } catch (exception e) { // todo: handle exception //e.printstacktrace(); //return "exception"; return e.tostring(); } } catch (exception e) { // todo: handle exception e.printstacktrace(); log.v("soap exception", e.tostring()); //return "exception"; return e.tostring(); } }
Comments
Post a Comment