Dear guys,
first of all thank you for building such a great product.
Great help for all of us coming from VB.NET world.
I'm rewriting the way I was consuming Webservices to avoid main on thread exception so I'm trying to use HttpUtils2.
I'm not able to get any output to webservice I'm using to send data coming from MySQL DB.
You may test webservice here:
http://fieldservice.the-mobility-group.com/webservices/descarga.php?tabla=Tipo_Usuario&format=json
This is the way I'm calling webservice
And these are the subs where work is taking place
I'm using JobDone example you gave!
Crash is giving an error with JSON parsing but this is not important since parsing works, the problem is trying to parse a void string.
Do you have any clue?
Thank you in advance for your help.
Best regards
Jose Luis
first of all thank you for building such a great product.
Great help for all of us coming from VB.NET world.
I'm rewriting the way I was consuming Webservices to avoid main on thread exception so I'm trying to use HttpUtils2.
I'm not able to get any output to webservice I'm using to send data coming from MySQL DB.
You may test webservice here:
http://fieldservice.the-mobility-group.com/webservices/descarga.php?tabla=Tipo_Usuario&format=json
This is the way I'm calling webservice
B4X:
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim job As HttpJob
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim Button1 As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
job.Initialize("Sincronizar",Me)
BaseDatos.Inicializacion_DB(Main.bdbsql,"FieldService.db")
ProgressDialogShow("Cargando datos ...")
Sincronizar_TablasDescarga
ProgressDialogHide
End Sub
B4X:
Sub DescargarDatos(tabla As String)
Main.tablaComunicaciones = tabla
'job.Initialize("Sincronizar",Me)
job.PostString(Main.url, "?tabla=" & tabla & "&" & "format=json")
End Sub
Sub Sincronizar_TablasDescarga
DescargarDatos("Tipo_Usuario")
DescargarDatos("Usuario")
End Sub
I'm using JobDone example you gave!
B4X:
Sub JobDone (pJob As HttpJob)
Dim result As String
Log("JobName = " & pJob.JobName & ", Success = " & pJob.Success)
If pJob.Success = True Then
Select pJob.JobName
Case "Sincronizar"
' Procesamos los resultados
result = pJob.GetString
Log("Salida:" & result)
ParsearDatosTablas(result)
Case "Job3"
Log(pJob.GetString)
End Select
Else
Log("Error: " & pJob.ErrorMessage)
ToastMessageShow("Error: " & pJob.ErrorMessage, True)
End If
pJob.Release
End Sub
Crash is giving an error with JSON parsing but this is not important since parsing works, the problem is trying to parse a void string.
B4X:
** Activity (main) Pause, UserClosed = true **
** Activity (login) Create, isFirst = true **
** Activity (login) Resume **
** Service (httputils2service) Create **
** Service (httputils2service) Start **
** Service (httputils2service) Start **
** Service (httputils2service) Start **
JobName = Sincronizar, Success = true
Salida:
JobName = Sincronizar, Success = true
Salida:
login_parseardatostablas (B4A line: 123)
nivelTop = parser.NextObject
org.json.JSONException: End of input at character 2 of
at org.json.JSONTokener.syntaxError(JSONTokener.java:450)
at org.json.JSONTokener.nextValue(JSONTokener.java:97)
at anywheresoftware.b4a.objects.collections.JSONParser.NextObject(JSONParser.java:45)
at tmg.fieldservice.login._parseardatostablas(login.java:468)
at tmg.fieldservice.login._jobdone(login.java:401)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:165)
at anywheresoftware.b4a.keywords.Common$4.run(Common.java:884)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at anywheresoftware.b4a.Msgbox.waitForMessage(Msgbox.java:211)
at anywheresoftware.b4a.Msgbox.debugWait(Msgbox.java:156)
at anywheresoftware.b4a.debug.Debug.wait(Debug.java:210)
at anywheresoftware.b4a.debug.Debug.reachBP(Debug.java:257)
at anywheresoftware.b4a.debug.Debug.ErrorCaught(Debug.java:146)
at tmg.fieldservice.login._parseardatostablas(login.java:602)
Do you have any clue?
Thank you in advance for your help.
Best regards
Jose Luis