简体   繁体   中英

Cannot Reslove setName,setValue,setType method of class PropertyInfo in Android Project

PropertyInfo celsiusPI = new PropertyInfo();
celsiusPI.setName("Celcius");
celsiusPI.setValue(celsius);
celsiusPI.setType(double.class);
request.addProperty(celsiusPI);

I use ksoap2-android-full-2.1.2 in my project.

if Celcius is a class, then use celsius.getClass() insted of double.class.

This is how I implement a ComplexClass in KSOAP-2 requset.

    //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);

If your celcius is a complex class, you have to do like I have mentioned above.

Thank you :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM