Thank you Euro for your reply.
I have a query while accesing web service.
I am accessing my Email sending webservice in b4a.
In Process_Globals funtion, I have declared the following with my public webservice url defined in PostUrl string
Dim HttpClient1 As OkHttpClient
Dim PostUrl As String
I have initialised my httpclient in Activity_Create if FirstTime
HttpClient1.Initialize("HttpClient1")
Then in my scenario where i want to send email, I am executing the request as follows:
Dim request As OkHttpRequest
request.InitializeGet(PostUrl)
request.Timeout = 100000 'set timeout to 10 seconds
If HttpClient1.Execute(request, 1) = False Then Return 'Will be false if their is already a running task (with the same id).
ProgressDialogShow("Sending Email...")
I have also used the Success and Error event for getting response as follows.
Sub HttpClient1_ResponseSuccess (Response As OkHttpResponse, TaskId As Int)
Log("ResponseSuccess")
ProgressDialogHide
End Sub
Sub HttpClient1_ResponseError (Reason As String, StatusCode As Int, TaskId As Int)
Log(Reason)
Log(StatusCode)
ProgressDialogHide
Dim msg As String
msg = "Error connecting to server."
If Reason <> Null Then msg = msg & CRLF & Reason
ToastMessageShow (msg, True)
End Sub
When I try to send email, eventhough my response is a sucess, I am not receiving any emails. Can you please help me on this.
Also, If I need to pass parameters to my webservice, how can I acheive the same?
I tried the above using HttpClient instead of OkHttpClient, but i am getting below exception
If HttpClient1.Execute(request, 1) = False Then
javac 1.8.0_76-release
src\b4a\EnTrackBLE\actmonitor.java:405: error: cannot access ClientProtocolException
if (_httpclient1.Execute(processBA,_request,(int) (1))==anywheresoftware.b4a.keywords.Common.False) {
^
class file for org.apache.http.client.ClientProtocolException not found