android4中的soap webservice

时间:2018-10-08 07:39:24

标签: java web-services android-studio soap

为什么SOAP web service在android 4中不是连接,而在其他版本的android工作中。

这是我与soap web service一起工作的代码,它在所有版本中均适用,但在android v4中不适用。我更改了库的不同版本,但错误仍然存​​在。

这是我的错误:

enter image description here

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 "";
    }
}

0 个答案:

没有答案