kSOAP2双标识异常 [英] kSOAP2 double ID exception

查看:199
本文介绍了kSOAP2双标识异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用KSOAP 2在我的Andr​​oid应用程序,当我试图执行一个特定的web服务请求时,我最终得到抛出了双标识的例外。我能寻找到这个被扔在KSOAP源$ C ​​$ C,它是在 SoapSerializationEnvelope 类方法公开对象的read()以下是从code显示异常的摘录被抛出:

I am attempting to use kSOAP 2 in my android application, and when I try to perform a particular webservice request, I end up getting thrown a "double ID" exception. I was able to find where this gets thrown in the kSOAP source code, it is in the SoapSerializationEnvelope class method public Object read() Here is an excerpt from that code showing the exception being thrown:

        if (id != null) {
            Object hlp = idMap.get(id);
            if (hlp instanceof FwdRef) {
                FwdRef f = (FwdRef) hlp;
                do {
                    if (f.obj instanceof KvmSerializable)
                        ((KvmSerializable) f.obj).setProperty(f.index, obj);
                    else
                        ((Vector) f.obj).setElementAt(obj, f.index);
                    f = f.next;
                } while (f != null);
            } else if (hlp != null)
                throw new RuntimeException("double ID");
            idMap.put(id, obj);
        }

我并不知道这是什么例外的是什么,或者我怎么能解决这个问题。任何人都知道什么是处理这个例外?

I'm not at all sure what this exception is about, or how I can fix it. Anyone know what the deal with this exception is?

感谢

编辑:

应当指出的是,我也使用在iOS版本申请的一个SOAP web服务的连接方法,而同样的确切请求没有任何问题。

It should be noted that I am also using a SOAP webservice connection method in the iOS version of this application, and the same exact request does not have any problems.

新的信息:

经仔细检查,这个问题似乎是从XML响应我收到含有产生的< diffgr:前> 元素,它具有相同的ID表如上。我觉得这是问题的原因,我已经完成了这一点其他的请求不具有的元素在其中,并没有异常。所以要加的问题:我可以停止Web服务从它的响应发送该块,或得到KSOAP忽略它。

Upon closer inspection, the problem seems to be resulting from the xml response I am getting containing a <diffgr:before> element, which has tables with the same ID as above. I think this is the cause of the problem, the other requests I have performed up to this point do not have that element in them, and do not have the exception. So to add to the question: can I stop the webservice from sending this block in its response, or get kSOAP to ignore it?

推荐答案

我可以通过删除 diffgr来解决此问题:之前元素中的Web服务进行发送。我这样做,感谢这个帖子

I was able to resolve this by removing the diffgr:before element the webservice was sending. I did that thanks to this post

这篇关于kSOAP2双标识异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆