ksoap2 xmlPullParserException未终止的实体参考(ksoap2 xmlPullParserException unterminated entity ref)
我昨天有一个用户给我发电子邮件,他说我的应用程序有问题,所以我开始与他一起调试,并让他给我发送电话日志,当他打电话给服务器时,他得到一个
XmlPullParserError
E/Message Exchange::CallWebService(6426): Exception: org.xmlpull.v1.XmlPullParserException: unterminated entity ref (position:TEXT �������`I�...@1:18 in java.io.InputStreamReader@406c8808) 05-31 12:33:25.573 W/System.err(6426): org.xmlpull.v1.XmlPullParserException: unterminated entity ref (position:TEXT �������`I�...@1:18 in java.io.InputStreamReader@406c8808) 05-31-12:33:25.573 W/System.err(6426): at org.kxml2.io.KXmlParser.exception(KXmlParser.java:273)05-31 12:33:25.573 W/System.err(6426): at org.kxml2.io.KXmlParser.error(KXmlParser.java:269)05-31-12:33:25.573 W/System.err(6426): at org.kxml2.io.KXmlParser.pushEntity(KXmlParser.java:781)05-31 12:33:25.573 W/System.err(6426): at org.kxml2.io.KXmlParser.pushText(KXmlParser.java:849)05-31 12:33:25.573 W/System.err(6426): at org.kxml2.io.KXmlParser.nextImpl(KXmlParser.java:354)05-31 12:33:25.573 W/System.err(6426): at org.kxml2.io.KXmlParser.next(KXmlParser.java:1378)05-31 12:33:25.573 W/System.err(6426): at org.kxml2.io.KXmlParser.nextTag(KXmlParser.java:1408)05-31 12:33:25.573 W/System.err(6426): at org.ksoap2.SoapEnvelope.parse(SoapEnvelope.java:126)05-31 12:33:25.573 W/System.err(6426): at org.ksoap2.transport.Transport.parseResponse(Transport.java:100)05-31 12:33:25.573 W/System.err(6426): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:195)05-31 12:33:25.573 W/System.err(6426): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:95)05-31 12:33:25.573 W/System.err(6426): at ecm2.android.MessageExchange$1.run(MessageExchange.java:96)05-31 12:33:25.573 W/System.err(6426): at java.lang.Thread.run(Thread.java:1019)05-31 12:33:27.928
这是它总是失败的路线
trans.call(SOAP_ACTION, soapEnvelope);
这使得对服务器的调用,它只是抛出一个错误。 我拥有和这个人
same exact phone
,我让他运行exact version I am running
的exact version I am running
,我没有问题,但是他仍然有问题。我让他卸载并重新安装好几次,所以我不知道会在手机上导致这种情况,而不是我的?
这是我如何创建XML
private static String CreateCallXML(String sDeviceID, String sEMailAddress, String sVersion) { Logging logger = new Logging(); XmlSerializer serializer = Xml.newSerializer(); StringWriter writer = new StringWriter(); try { serializer.setOutput(writer); serializer.startDocument("UTF-8", true); serializer.startTag("", "PostData"); serializer.startTag("", "RetrieveMsg"); serializer.attribute("", "ver", sVersion); serializer.attribute("", "DevID", sDeviceID); serializer.attribute("", "eMailAddress", sEMailAddress); logger.append("D", className, "CreateCallXML", "LastIncMsgID:" + Settings.LastIncMsgID); logger.append("D", className, "CreateCallXML", "LastDLMsgID: " + Settings.LastDLMsgID); serializer.attribute("", "LastIncMsgID", "" + Settings.LastIncMsgID); serializer.attribute("", "LastDLMsgID", "" + Settings.LastDLMsgID); serializer.endTag("", "RetrieveMsg"); serializer.endTag("", "PostData"); serializer.endDocument(); return writer.toString(); } catch (Exception e) { return null; } }
更新2:
在通过代码后,看起来用户的电子邮件地址是问题,用户的电子邮件地址的示例是
abcd3961@gmail.com
如果我使用它,它会在打电话给服务器时引发异常。 如果我在电子邮件地址中更改了一个字母,它会正常执行呼叫。这是一个ksoap问题? 我怎么能解决这个问题,因为我不能告诉他改变他的电子邮件地址?
I have a user email me yesterday that he is having a problem with my application so i started debugging with him and had him sent me the log of the phone and he is getting a
XmlPullParserError
when he makes a call to the serverE/Message Exchange::CallWebService(6426): Exception: org.xmlpull.v1.XmlPullParserException: unterminated entity ref (position:TEXT �������`I�...@1:18 in java.io.InputStreamReader@406c8808) 05-31 12:33:25.573 W/System.err(6426): org.xmlpull.v1.XmlPullParserException: unterminated entity ref (position:TEXT �������`I�...@1:18 in java.io.InputStreamReader@406c8808) 05-31-12:33:25.573 W/System.err(6426): at org.kxml2.io.KXmlParser.exception(KXmlParser.java:273)05-31 12:33:25.573 W/System.err(6426): at org.kxml2.io.KXmlParser.error(KXmlParser.java:269)05-31-12:33:25.573 W/System.err(6426): at org.kxml2.io.KXmlParser.pushEntity(KXmlParser.java:781)05-31 12:33:25.573 W/System.err(6426): at org.kxml2.io.KXmlParser.pushText(KXmlParser.java:849)05-31 12:33:25.573 W/System.err(6426): at org.kxml2.io.KXmlParser.nextImpl(KXmlParser.java:354)05-31 12:33:25.573 W/System.err(6426): at org.kxml2.io.KXmlParser.next(KXmlParser.java:1378)05-31 12:33:25.573 W/System.err(6426): at org.kxml2.io.KXmlParser.nextTag(KXmlParser.java:1408)05-31 12:33:25.573 W/System.err(6426): at org.ksoap2.SoapEnvelope.parse(SoapEnvelope.java:126)05-31 12:33:25.573 W/System.err(6426): at org.ksoap2.transport.Transport.parseResponse(Transport.java:100)05-31 12:33:25.573 W/System.err(6426): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:195)05-31 12:33:25.573 W/System.err(6426): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:95)05-31 12:33:25.573 W/System.err(6426): at ecm2.android.MessageExchange$1.run(MessageExchange.java:96)05-31 12:33:25.573 W/System.err(6426): at java.lang.Thread.run(Thread.java:1019)05-31 12:33:27.928
this is the line it always fails at
trans.call(SOAP_ACTION, soapEnvelope);
that makes the call to the server and it just throws an error. I have the
same exact phone
this person has and I had him running theexact version I am running
, I had not problems calling the server but he still had a problem.I had him uninstall and reinstall several times so I dont know what would cause this on his phone and not mine?
this is how i create the XML
private static String CreateCallXML(String sDeviceID, String sEMailAddress, String sVersion) { Logging logger = new Logging(); XmlSerializer serializer = Xml.newSerializer(); StringWriter writer = new StringWriter(); try { serializer.setOutput(writer); serializer.startDocument("UTF-8", true); serializer.startTag("", "PostData"); serializer.startTag("", "RetrieveMsg"); serializer.attribute("", "ver", sVersion); serializer.attribute("", "DevID", sDeviceID); serializer.attribute("", "eMailAddress", sEMailAddress); logger.append("D", className, "CreateCallXML", "LastIncMsgID:" + Settings.LastIncMsgID); logger.append("D", className, "CreateCallXML", "LastDLMsgID: " + Settings.LastDLMsgID); serializer.attribute("", "LastIncMsgID", "" + Settings.LastIncMsgID); serializer.attribute("", "LastDLMsgID", "" + Settings.LastDLMsgID); serializer.endTag("", "RetrieveMsg"); serializer.endTag("", "PostData"); serializer.endDocument(); return writer.toString(); } catch (Exception e) { return null; } }
Update 2:
after going through the code it appears that the users email address is the problem an example of the users email address is
abcd3961@gmail.com
if I use that it throws the exception when it hits the line to make the call to the server. If I change one letter in the email address it executes the call fine.is this a ksoap problem? and how can I get around this as i cannot tell him to change his email address?
原文:https://stackoverflow.com/questions/10851616
最满意答案
尝试以下方法:
var onLoad = function(){ document.addEventListener("deviceready", deviceReady, false); }; var deviceReady = function(){ document.addEventListener("backbutton", exitCordova, false); alert('listening to device ready'+navigator); navigator.splashscreen.hide(); }; var exitCordova = function(){ navigator.app.exitApp(); };
Try something like :
var onLoad = function(){ document.addEventListener("deviceready", deviceReady, false); }; var deviceReady = function(){ document.addEventListener("backbutton", exitCordova, false); alert('listening to device ready'+navigator); navigator.splashscreen.hide(); }; var exitCordova = function(){ navigator.app.exitApp(); };
相关问答
更多-
不知道发生了什么,但我最终做的是创建远程回购的新克隆,并将我的启动画面相关更改应用到本地计算机上的新实例。 然后我执行以下操作: ionic platform rm ios ionic platform add ios ionic build ios ......并且它能够离开闪屏。 希望这可以帮助。 Not sure what happened but what I ended up doing is creating a new clone of the remote repo and applied ...
-
模拟器中的iOS 6自转与实际的iOS 6设备有所不同(iOS 6 autorotation in simulator varies from actual iOS 6 device)[2023-09-26]
这就是我为了让我的应用程序再次运行而添加的内容: // Tell the system what we support - (NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskAllButUpsideDown; } // Tell the system It should autorotate - (BOOL) shouldAutorotate { return YES; } // T ... -
if (([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera] == NO) 上述条件确保模拟器无法运行它,因为模拟器没有摄像头。 if (([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera] == NO) The above c ...
-
检测设备是否为iOS(Detect if device is iOS)[2021-11-06]
检测iOS 我不是用户代理嗅探的粉丝,但这里是你会如何做的: var iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream; 另一种方式,依赖于deprecated navigator.platform : var iOS = !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform); iOS将是true或false 为什么不MSStrea ... -
iOS MDM:我们可以了解设备是root还是越狱?(iOS MDM: Can we get to know whether device is rooted or jailbroken?)[2024-01-10]
Apple MDM协议无法检查设备是否已越狱。 MDM供应商通常会为此提出自己的解决方案。 The Apple MDM protocol does not have a way to check if a device is jailbroken. MDM vendors will usually come up with their own solution for this. -
设备就绪ios无法正常工作(Device Ready ios not working)[2023-12-01]
尝试以下方法: var onLoad = function(){ document.addEventListener("deviceready", deviceReady, false); }; var deviceReady = function(){ document.addEventListener("backbutton", exitCordova, false); alert('listening to device ready'+navigator); navi ... -
我有过一次( 这里 ) - 它不是很漂亮,但我通过这样做解决了这个问题: cordova platform remove ios 然后(你猜对了)...... cordova platform add ios I had this once (here) - It wasn't pretty but I resolved it by doing: cordova platform remove ios and then (you guessed it)... cordova platform add ...
-
PhoneGap是一种应用程序容器技术,允许您使用HTML,CSS和JavaScript为移动设备创建本机安装的应用程序。 Phonegap cordova-2.1.0.js仅适用于iPhone应用程序。 它在Safari浏览器(IPhone)上不支持。 For testing PhoneGap / Cordova in a browser, use Ripple (Chrome). More info: http://emulate.phonegap.com/
-
Adcolony不工作(iOS)(Adcolony not working(iOS))[2022-11-05]
由于您的配置已成功,这可能是因为您的应用尚未在App Store中存在。 我们的系统不会向玩家无法下载的应用发送实时广告。 要打开测试广告,请登录AdColony信息中心( https://clients.adcolony.com )并打开您正在使用的应用。 进入您正在使用的每个区域的设置,并为“仅显示测试广告?”选择是; 然后单击此下方的“保存”按钮。 如果您已经在使用测试广告,请通过support@adcolony.com与我们的支持团队联系以获取进一步的帮助。 Since your configura ... -
这有一些历史:创建NSObject的通用子类从来就不是受支持的场景,但遗憾的是MonoTouch从未强制执行,也没有对这个事实发出警告。 所以人们当然最终做到了这一点。 然后有一天,我不得不追踪看起来像真正的heisenbug的东西,事实证明(经过几个小时的令人沮丧的调试)是因为有问题的项目使用了NSObject的通用子类。 确切的细节并不重要,但是当警告被添加到MonoTouch时。 我的观点是人们长期使用NSObject的通用子类,而不会遇到任何问题。 如果您广泛测试您的应用程序(无论如何应该这样做), ...