我試圖通過KSOAP(2.5.8)調用公共Web服務。但它無法從冰淇淋三明治版本的服務中獲取數據。它在2.2和2.3等較低版本中工作良好。 這是我的代碼。Webservice不工作在Android冰淇淋三明治(API 15)
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;
}
每次返回錯誤導致冰淇淋三明治。它不顯示錯誤日誌中的任何內容。我應該在這裏改變什麼。 PLZ幫助我。
接受您以前提問的問題和任何錯誤,同時連接到網絡服務 –
好的。 連接時無錯誤。 – Tej