Webservice在android冰淇淋三明治中不起作用(api 15)
我试图通过KSOAP(2.5.8)调用公共web服务。但它无法从冰淇淋三明治版本的服务中获取数据。它在2.2和2.3这样的低版本中工作正常。 这是我的密码Webservice在android冰淇淋三明治中不起作用(api 15),android,web-services,ksoap2,Android,Web Services,Ksoap2,我试图通过KSOAP(2.5.8)调用公共web服务。但它无法从冰淇淋三明治版本的服务中获取数据。它在2.2和2.3这样的低版本中工作正常。 这是我的密码 import org.ksoap2.SoapEnvelope; import org.ksoap2.serialization.PropertyInfo; import org.ksoap2.serialization.SoapObject; import org.ksoap2.serialization.SoapPrimitive; imp
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.PropertyInfo;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import android.util.Log;
public class WebService {
private final String NAMESPACE ="http://aaaaaa.org/";
private final String URL ="http://5xxxxxxxxxxx.asmx?WSDL";
public boolean checkUser(String _EmailID, String _Password) {
boolean result = false;
final String SOAP_ACTION ="http://aaaaaaaa/Login";
final String METHOD_NAME = "Login";
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
PropertyInfo propertyInfoEmail = new PropertyInfo();
propertyInfoEmail.setName("_EmailID");
propertyInfoEmail.setValue(_EmailID);
propertyInfoEmail.setType(String.class);
request.addProperty(propertyInfoEmail);
PropertyInfo propertyInfoPassword = new PropertyInfo();
propertyInfoPassword.setName("_Password");
propertyInfoPassword.setValue(_Password);
propertyInfoPassword.setType(String.class);
request.addProperty(propertyInfoPassword);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true; // put this only if the web service is .NET one
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try {
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapPrimitive response = (SoapPrimitive)envelope.getResponse();
Log.i("myApp", response.toString());
if(response.toString().equalsIgnoreCase("true")){
result = true;
}
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
每次它在冰淇淋三明治中返回错误结果。它不会在错误日志中显示任何内容。我应该在这里换什么。请帮帮我。问题是ICS不允许你在活动中做一些网络工作。这意味着您必须将对web服务的调用放在后台任务(AsyncTask)中。在该链接中,您可以看到要执行的操作:在连接到web服务时,接受您以前提出的问题的答案和任何错误OK。连接时没有错误。