在 ksoap 对象中从 Internet 请求数据时发生错误
public String[] getProfile(String email) {
String[] profileArray = new String[3];
METHOD_NAME = "getProfile";
SoapObject getprofileSoapObject = new SoapObject(NAMESPACE,METHOD_NAME);
//To avoid code duplication getproperty. Set info
getprofileSoapObject.addProperty(setProperty("email", email));
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(getprofileSoapObject);
HttpTransportSE http = new HttpTransportSE(URL);
try { //call httptransport
http.call(SOAP_ACTION, envelope);
SoapObject SoapObject2 = (SoapObject) envelope.bodyIn;
//Set profile detail
profileArray[0] = SoapObject2.getProperty(0).toString();
profileArray[1] = SoapObject2.getProperty(1).toString();
profileArray[2] = SoapObject2.getProperty(2).toString();
return profileArray;
} catch (Exception e) {
//System.out.println(e.getMessage());
}
return profileArray;
}
http.call 后出现 NullPointerException 错误