我正在尝试使用 ksoap2 库在 Android 应用程序中使用 .NET 服务。我在我的项目中添加了对 ksoap2-android-assembly-2.6.5-jar-with-dependencies jar 的引用。但是当我运行代码时,我得到一个运行时异常说
java.lang.NoClassDefFound : org.ksoap2.serialization.SoapObject.
有人可以帮忙吗?这是我的代码。
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope envelope =
new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try {
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapObject resultsRequestSOAP = (SoapObject) envelope.bodyIn;
tvTemp.setText("Received :" + resultsRequestSOAP.toString());
} catch (Exception e) {
e.printStackTrace();
}