Hi All,
My first post in a few years...
My B4A app is failing to connect to our web service. ResponseError: Unable to resolve host "sav-app1": No address associated with hostname.
I started with the first Dim in the Process_Globals and then tried the 2nd Dim, and it fails with a time out: ResponseError: "failed to connect to /" 192.168.10.161 (port 80), after 30000ms, Response:
Where the A5W is Alpha 5 Anywhere web service on our DMZ and it returns JSON formatted data no problem; in a browser and in a desktop app called Postman.
The tablet is connecting to the web service via WiFi in the office.
Q's:
Is the URL format correct?
If not, what are my options of defining the URL so that B4A app will submit to the web service correctly?
What needs to be changed?
TIA,
Mark Stuart
(Palace Entertainment)
Activity Code:
My first post in a few years...
My B4A app is failing to connect to our web service. ResponseError: Unable to resolve host "sav-app1": No address associated with hostname.
I started with the first Dim in the Process_Globals and then tried the 2nd Dim, and it fails with a time out: ResponseError: "failed to connect to /" 192.168.10.161 (port 80), after 30000ms, Response:
Where the A5W is Alpha 5 Anywhere web service on our DMZ and it returns JSON formatted data no problem; in a browser and in a desktop app called Postman.
The tablet is connecting to the web service via WiFi in the office.
Q's:
Is the URL format correct?
If not, what are my options of defining the URL so that B4A app will submit to the web service correctly?
What needs to be changed?
TIA,
Mark Stuart
(Palace Entertainment)
Activity Code:
B4X:
Sub Process_Globals
' As you can see the web service is expecting an argument and value:
Dim ParkUsersLink As String = "http://SAV-APP1/Palace/GetParkUsers.A5W?LocCode="
'Dim ParkUsersLink As String = "http://192.168.10.161/Palace/GetParkUsers.A5W?LocCode=703"
End Sub
Sub btnFetchParkUsers_Click
GetParkUsersJSON(txtLocCode.Text) 'user input value = 703
End Sub
Sub GetParkUsersJSON (LocCode As String)
ProgressDialogShow("Fetching User JSON list...")
'ExecuteParkUsersList("SELECT UserID,UserName,Password,SecGroup FROM Users ORDER BY UserID",LocCode)
ExecuteParkUsersList(ParkUsersLink,LocCode)
End Sub
Sub ExecuteParkUsersList(Query As String,LocCode As String)
Dim Job As HttpJob
Job.Initialize("ParkUsers",Me)
Job.PostString(Query,"")
End Sub '<== finishes here and then finally runs Sub JobDone after timing out
Sub JobDone(Job As HttpJob)
If Job.Success Then
ProgressDialogShow("Inserting Users into SQL table...")
Dim res As String
res = Job.GetString
Log("Response from server: " & res)
Dim parser As JSONParser
parser.Initialize(res)
Dim root As Map = parser.NextObject
Dim items As List = root.Get("items")
Main.conn.BeginTransaction
For Each colitems As Map In items
Dim UserName As String = colitems.Get("UserName")
Dim UserID As String = colitems.Get("UserID")
Dim SecGroup As String = colitems.Get("SecGroup")
Dim Password As String = colitems.Get("Password")
'insert to sqlite table: ParkUsers
Try
Main.conn.ExecNonQuery("INSERT OR REPLACE INTO ParkUsers (UserID, UserName, Password, SecGroup) VALUES (" & _
UserID & "," & UserName & "," & Password & "," & SecGroup & ")")
Catch
Log(LastException.Message) '<== goes directly here after starting this code
End Try
Next
Main.conn.EndTransaction
Else
Log(Job.ErrorMessage)
ToastMessageShow("Error: " & Job.ErrorMessage,True)
End If
Job.Release
ProgressDialogHide
End Sub