KSOAP 元素的排序

发布于 2024-12-20 23:08:07 字数 1150 浏览 0 评论 0原文

我一直在使用 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版本。

任何建议表示赞赏!

I've been using KSOAP for Android to send SOAP requests containing 6 elements, the last of which is an array of values. Here's the code ...

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

Everything works fine in the request, bar the ordering. When I call addSoapObject, it places the array values first in the body request. So everything inside the eventValues element appears at the top of the request. It should be the last element for the request to succeed. All other property elements are in the correct order.

Is there some way to dictate the order to KSOAP? I'm using version 2.6.0.

Any suggestions appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

猫性小仙女 2024-12-27 23:08:07

如果你想修复它,这里有一个补丁和lib ksoap2-android- assembly-2.6.1--jar-with-dependency.jar
http://fbe.am/3k <---- 2 个补丁和 lib

这里是主题:< a href="http://groups.google.com/group/ksoap2-android/browse_thread/thread/1ee05350dd8c041" rel="nofollow">http://groups.google.com/group/ksoap2-android/browse_thread/thread/1ee05350dd8c041

非常感谢 Andrew O。这也是他的修复库(补丁是从他)http://github.com/Usagimaru57/ksoap2-android

它对我有用。

If you want to fix it here is a patch and lib ksoap2-android-assembly-2.6.1--jar-with-dependencies.jar
http://fbe.am/3k <---- 2 patches and lib

Here is the topic: http://groups.google.com/group/ksoap2-android/browse_thread/thread/1ee05350dd8c041

Thx a lot to Andrew O. here is his repo with fixes too (patches are generated from him) http://github.com/Usagimaru57/ksoap2-android

It works for me.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文