Hello Amigos!
I test the sample attached in this post https://www.b4x.com/android/forum/threads/webservice-rest.73466/#post-466819 from @DonManfred with my webservice. I make a very simple Web Api web service. and it doesn't works. Can anyone help me with this?
I test the sample attached in this post https://www.b4x.com/android/forum/threads/webservice-rest.73466/#post-466819 from @DonManfred with my webservice. I make a very simple Web Api web service. and it doesn't works. Can anyone help me with this?
B4X:
#Region Project Attributes
#ApplicationLabel: RestTest
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
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.
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
Dim Register As HttpJob
Register.Initialize("rest", Me)
' Register.Tag = "resttest.json"
' Register.Download("http://resttst.yaskawa.com.br:9090/rest/sample")
Register.Download("http://localhost/miws/api/Licencia/5")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub JobDone(Job As HttpJob)
ProgressDialogHide
If Job.Success Then
If Job.JobName = "rest" Then
'Dim out As OutputStream
'out = File.OpenOutput(File.DirRootExternal,Job.Tag,False )
'File.Copy2(Job.GetInputStream, out)
'out.Close
Log($"The job resttest finished "$)
ParseJSON(Job.GetString)
End If
Else
Log( Job.ErrorMessage)
End If
Job.Release
End Sub
Sub ParseJSON(jsonstring As String)
Dim parser As JSONParser
parser.Initialize(jsonstring)
Dim root As List = parser.NextArray
For Each colroot As Map In root
Dim name As String = colroot.Get("name")
Dim id As Int = colroot.Get("id")
Log($"${name} - ${id}"$)
Next
End Sub