kSOAP2双ID异常 [英] kSOAP2 double ID exception
问题描述
SoapSerializationEnvelope
类方法 public Object read()
以下是该代码的摘录,显示正在抛出的异常: 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);
}
我不知道这个例外是什么,还是我怎么样可以修复它任何人都知道这个例外的处理是什么?
谢谢
编辑:
应该注意的是,我也在这个应用程序的iOS版本中使用SOAP webservice连接方法,同样的确切请求没有任何问题。
新信息:
仔细检查后,问题似乎是由xml响应导致的,我收到一个< ; diffgr:before>
元素,其中具有与上述相同ID的表。我认为这是问题的原因,我已经执行的其他请求在这一点上没有这个元素,没有例外。所以要补充一点:我可以停止webservice在其响应中发送这个块,还是让kSOAP忽略它?
p>我可以通过删除webservice发送之前的 diffgr:
元素来解决这个问题。我这样做感谢这篇文章
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?
Thanks
Edit:
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.
New information:
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?
I was able to resolve this by removing the diffgr:before
element the webservice was sending. I did that thanks to this post
这篇关于kSOAP2双ID异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!