ksoap - Android ksoap2 object reference null exception -
here class calling soap. i'm getting following error , don't understand why.
ava.lang.nullpointerexception: attempt invoke virtual method 'java.lang.string org.ksoap2.serialization.soapprimitive.tostring()' on null object reference
public class webservicescontroller { private static final string namespace = "http://mywebsite.com:9000/"; private static final string asmxurl = "services.asmx?"; private string tag = "pgguru"; static soapprimitive resultstring; public static void soapactionexecutestoredprocedure(string method_name,list<string> argumentpipevalue) throws xmlpullparserexception, ioexception { soapobject request = new soapobject(namespace, method_name); //add arguments in (string arg : argumentpipevalue) { string[] splitargs = arg.split("|"); request.addproperty(splitargs[0], splitargs[1]); } soapserializationenvelope envelope = new soapserializationenvelope(soapenvelope.ver11); envelope.setoutputsoapobject (request); envelope.dotnet = true; httptransportse ht = new httptransportse(namespace+asmxurl); ht.call (method_name, envelope); soapobject response = (soapobject)envelope.getresponse(); string result = response.getproperty(0).tostring(); } } and here how call it.
bt.setonclicklistener( new view.onclicklistener() { @override public void onclick(view v) { log.i(tag, "doinbackground"); list<string> myargs = new arraylist<string>(); myargs.add("_caseid|apples"); try { webservicescontroller.soapactionexecutestoredprocedure("djprovider_delete", myargs); } catch (exception e) { } } }); any pointers fantastic. don't understand how use ksoap, i've followed few tutorials , keep getting error.
i think getting error on line
**string result = response.getproperty(0).tostring();**
if that's case please check whether getting response @ all. if getting no response @ all, reason.
check if providing arguments webservice correctly. when using soap have provide arguments in particular structure, soap object inside soap object. check soap object creating , 1 required same. (just print request.tostring() checking)
ps: meant put in comment section. dont have enough reputation.
Comments
Post a Comment