使用SoapUI进行测试时,我的webservice提供了完美的输出,但是当我尝试从代码中访问时,它会给出nullpointer异常,不知道我做错了什么 下面是我的代码和工作网址。
public class Insertdata extends AsyncTask<String, String, String> {
private final String NAMESPACE = "http://tempuri.org";
private final String URL = "http://10.188.7.102/GetCarpoolDetails/GetCarpoolDetailsService.svc?wsdl";
private final String SOAP_ACTION = "http://tempuri.org/IGetCarpoolDetailsService/getUserDetails";
private final String METHOD_NAME = "getUserDetails";
HttpResponse response = null;
String result = null;
String status;
@Override
protected String doInBackground(String... params) {
SoapObject soapObject;
soapObject = new SoapObject(NAMESPACE, METHOD_NAME);
soapObject.addProperty("Empid","44");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.implicitTypes = true;
envelope.setOutputSoapObject(soapObject);
System.out.println("envelope---------"+envelope.bodyOut);
HttpTransportSE androidHttpTransport;
androidHttpTransport = new HttpTransportSE(URL);
try{
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapPrimitive response = (SoapPrimitive)envelope.getResponse();
status = response.toString();
System.out.println("status==========="+status);
System.out.println("Posted Ride Sucsessfully");
}
catch(Exception e){
System.out.println("checking error====="+e.toString());
}
return null;
}
}
下面是我的stackTrace
02-17 09:31:32.863: I/System.out(5219): envelope---------getUserDetails{Empid=44; }
02-17 09:31:32.883: D/dalvikvm(5219): GC_FOR_ALLOC freed 297K, 14% free 2694K/3132K, paused 25ms, total 25ms
02-17 09:31:33.113: I/System.out(5219): checking error=====java.lang.NullPointerException
真的很感激任何帮助。