Here is my class which is calling the SOAP. I'm getting the following error and I don't understand why.
ava.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String org.ksoap2.serialization.SoapPrimitive.toString()' on a 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 to
for (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 is how I 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 would be fantastic. It could be I don't completely understand how to use KSoap, but i've followed a few tutorials and I keep getting this error.