Bambang Bayu Aji
New Member
I am using B4A for android developing and Visual Studio WEB API that return JSON to create web service
But I got error while compiling the code :
These are the error messages
Compiling generated Java code. Error
B4A line: 108
hc.Execute(req, TaskId)
javac 1.8.0_144
src\b4a\example\main.java:413: error: cannot access ClientProtocolException
_hc.Execute(processBA,_req,_taskid);
^
class file for org.apache.http.client.ClientProtocolException not found
My Web API can be accessed by using this command URL on browser and return JSON
http://localhost:57750/api/Nuser/002/JK1.ACMHAD/password/_/_/_
While 002/JK1.ACMHAD/password/_/_/_ are the parameters
And the code in B4A is :
Sub cmdLogin_Click
If txtUserName.Text = "" Or txtPassword.Text="" Then
Msgbox("Username and Password cant be empty!","Peringatan")
Else
ExecuteRemoteQuery("002/" & txtUserName.text & "/" & txtPassword.text & "/_/_/_", GlobalLoginUser)
End If
End Sub
Sub ExecuteRemoteQuery(Parameters As String, TaskId As Int)
Dim req As HttpRequest
Dim a As String
req.InitializePost2("http://10.102.4.149:8040/api/Nuser/" & Parameters, a.GetBytes("UTF8"))
hc.Execute(req, TaskId)
End Sub
Please help.
But I got error while compiling the code :
These are the error messages
Compiling generated Java code. Error
B4A line: 108
hc.Execute(req, TaskId)
javac 1.8.0_144
src\b4a\example\main.java:413: error: cannot access ClientProtocolException
_hc.Execute(processBA,_req,_taskid);
^
class file for org.apache.http.client.ClientProtocolException not found
My Web API can be accessed by using this command URL on browser and return JSON
http://localhost:57750/api/Nuser/002/JK1.ACMHAD/password/_/_/_
While 002/JK1.ACMHAD/password/_/_/_ are the parameters
And the code in B4A is :
Sub cmdLogin_Click
If txtUserName.Text = "" Or txtPassword.Text="" Then
Msgbox("Username and Password cant be empty!","Peringatan")
Else
ExecuteRemoteQuery("002/" & txtUserName.text & "/" & txtPassword.text & "/_/_/_", GlobalLoginUser)
End If
End Sub
Sub ExecuteRemoteQuery(Parameters As String, TaskId As Int)
Dim req As HttpRequest
Dim a As String
req.InitializePost2("http://10.102.4.149:8040/api/Nuser/" & Parameters, a.GetBytes("UTF8"))
hc.Execute(req, TaskId)
End Sub
Please help.