我一直在使用 Android 版 KSOAP 发送包含 6 个元素的 SOAP 请求,最后一个元素是一个值数组。这是代码...
PropertyInfo properties[] = new PropertyInfo[numberOfProperties];
properties[0] = new UserLogin("user2");
properties[1] = new UserPassword("u2");
properties[2] = new MAC_ID("00:01:02:03:04:05");
properties[3] = new StartMeasurement(mStartTime);
properties[4] = new StopMeasurement(mStopTime);
SoapObject soapObjectRequest = new SoapObject(ROOT_NAMESPACE, mSoapMethodName);
for(int i=0;i< properties.length;i++)
soapObjectRequest.addProperty(properties[i]);
SoapObject eventList = new SoapObject(ROOT_NAMESPACE, "eventValues");
SoapObject eventValues = new SoapObject(TYPE_NAMESPACE, "EventValues");
eventValues.addProperty(9.9);
eventValues.addProperty(101.1);
eventList.addSoapObject(eventValues);
soapObjectRequest.addSoapObject(eventList);
除了订购之外,请求中一切正常。当我调用 addSoapObject 时,它将数组值首先放置在正文请求中。因此 eventValues 元素内的所有内容都显示在请求的顶部。它应该是请求成功的最后一个元素。所有其他属性元素的顺序都正确。
是否有某种方法可以向 KSOAP 指定顺序?我使用的是2.6.0版本。
任何建议表示赞赏!
最佳答案
如果你想修复它,这里有一个补丁和lib ksoap2-android- assembly-2.6.1--jar-with-dependency.jar http://fbe.am/3k <---- 2个补丁和lib
这是主题:http://groups.google.com/group/ksoap2-android/browse_thread/thread/1ee05350dd8c041
非常感谢 Andrew O。这里也是他的修复库(补丁是由他生成的)http://github.com/Usagimaru57/ksoap2-android
这对我有用。
关于java - KSOAP 元素的排序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8477689/