为什么SOAP web service
在android 4中不是连接,而在其他版本的android工作中。
这是我与soap web service
一起工作的代码,它在所有版本中均适用,但在android v4中不适用。我更改了库的不同版本,但错误仍然存在。
这是我的错误:
public class GetAgendaList extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... strings) {
String namespace = "http://tempuri.org/";
String methodName = "GetAgendaListByDate";
String action = "http://tempuri.org/GetAgendaListByDate";
String URLL = "http://tempuri.org/Services/Def/WS_SessionInfo.asmx";
SoapObject soapObject = new SoapObject(namespace, methodName);
soapObject.addProperty("sessionDate", "2018-09-27");
soapObject.addProperty("Kind", "0");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.bodyOut = soapObject;
envelope.setOutputSoapObject(soapObject);
envelope.setOutputSoapObject(soapObject);
HttpTransportSE httpTransportSE = new HttpTransportSE(URLL);
httpTransportSE.setXmlVersionTag("<?xml version=\"1.0\" encoding= \"UTF-8\"?>");
try {
httpTransportSE.debug = true;
httpTransportSE.call(action, envelope);
} catch (IOException e) {
e.printStackTrace();
} catch (XmlPullParserException e) {
e.printStackTrace();
}
SoapObject result = null;
try {
result = (SoapObject) envelope.getResponse();
SoapObject result1 = (SoapObject) envelope.bodyIn;
agendaLists = new ArrayList<>();
Log.d("TAG", "doInBackground: " + result.toString());
} catch (SoapFault soapFault) {
soapFault.printStackTrace();
}
return "";
}
}