Android Question Need help with JSON Parser

yckhor

Member
Licensed User
Longtime User
Hi,
I created an app that communicates with asp.net web services to retrieve data from a backend MS SQL server (following the tutorial). The app was working until few days back when the httpjob that query the web services no longer working. It was later diagnosed to be due to firewall which was promptly resolved. Now, I have another problem. The JSON string passed back from the web services is no longer recognized as a JSON array. This is strange as I test by passing URL via a browser, it returns a qualified JSON string.

[{"Found":1}]

but in B4A, an error occurred

<html xmlns="http://www.w3.org/1999/xhtml">

<head><title>
</title></head>
<body>

<form method="post" action="SQLUser.aspx" id="form1">

<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="9um5ylNc0mXeSyhwcKNJPzkIpFroJx+EVL9WeVT3QqKFtnavbSGLWXKakGcUfRsGF67SPwJuvci2w9CShTgPKxD8tkWg9WUm02UyPN2YBwI=" />

<div>
</div>
</form>
</body>
</html>

Error occurred on line: 60 (main)
java.lang.RuntimeException: JSON Array expected.
at anywheresoftware.b4a.objects.collections.JSONParser.NextArray(JSONParser.java:59)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:485)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:229)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:174)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
at anywheresoftware.b4a.BA$3.run(BA.java:318)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5419)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
at dalvik.system.NativeStart.main(Native Method)


I had exported the test app in zip file attached for your review. Thanks!
 

Attachments

  • test.zip
    9.6 KB · Views: 183

yckhor

Member
Licensed User
Longtime User
Hi erel,
nope. I coded asp.net to return
[{"Found":1}] but instead of getting this, I got the HTML

Strangely, after I restarted my computer and now it seems back in order.
I have not change anything in code but it seems to work again.
 
Last edited:
Upvote 0
Top