Android 和 ksoup2

Android and ksoup2

我正在尝试使用 android 的 ksoup2 从服务器请求一些信息。 这是网络服务 SOAP 信息:

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <HappySpeakGetEventsMethod xmlns="http://www.outsystems.com">
      <email>string</email>
      <password>string</password>
    </HappySpeakGetEventsMethod>
  </soap:Body>
</soap:Envelope>

这是我的 Android 代码:

 try {
                SoapObject Request = new SoapObject(NAMESPACE, METHOD_NAME);
                Request.addProperty("email", "myemail@mail.com");
                Request.addProperty("password","mypassword");

                SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
                soapEnvelope.setOutputSoapObject(Request);

                HttpTransportSE trnasport = new HttpTransportSE(URL);
                trnasport.debug = true;
                trnasport.call(SOAP_ACTION, soapEnvelope);

                Object resultsString =  soapEnvelope.getResponse();
                resultsString.toString();
            } catch (Exception e) {
                e.printStackTrace();
            }

主要问题是请求到达服务器并且两个字段都是空的(如这个“”)。 谁能告诉我我做错了什么?

找到答案了! 命名空间字段错误,我必须添加:

 soapEnvelope.dotnet=true;