PropertyInfo celsiusPI = new PropertyInfo();
celsiusPI.setName("Celcius");
celsiusPI.setValue(celsius);
celsiusPI.setType(double.class);
request.addProperty(celsiusPI);
我在项目中使用ksoap2-android-full-2.1.2
。
答案 0 :(得分:0)
如果Celcius是一个类,那么使用double.class的celsius.getClass()。
这就是我在KSOAP-2 requset中实现ComplexClass的方法。
//Complex-type class implementation
getPendingAmountInfo pendingAmountInfo = new getPendingAmountInfo();
pendingAmountInfo.altCustomerId = altCustId;
pendingAmountInfo.authToken = authToken;
pendingAmountInfo.imei = LoginActivity.imeiNo;
PropertyInfo pendingAmtproperty = new PropertyInfo();
pendingAmtproperty.setName("pendingAmountInfo");
pendingAmtproperty.setValue(pendingAmountInfo);
pendingAmtproperty.setType(pendingAmountInfo.getClass());
//Creating Soap request object
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty(pendingAmtproperty);
如果你的celcius是一个复杂的类,你必须像我上面提到的那样。
谢谢:)