Android Question Servlet Response Always Return Empty Result

Ganiadi

Active Member
Licensed User
Longtime User
Hi, Please Help
I've been trying to solve below case but still have no solution
I write a B4A Http server to handle simple WEB Request, but it return nothing, while in the log its shows value

CODE:
Sub GetDeviceHandle(Request As ServletRequest, Response As ServletResponse)
Dim job2 As HttpJob
Dim cResult As String
   
   
    Try
        job2.Initialize("Job2", Me)
        job2.PostString("http://192.168.1.177/getparameter?address=206","")
        job2.GetRequest.SetContentType("text/plain")
       
        wait for (job2) JobDone(job2 As HttpJob)
        If job2.Success Then
            cResult = job2.GetString                      
        End If

    Catch
        Log(LastException)
    End Try

    Log(cResult)
   
    Response.SetContentType("text/html")
    Response.SendString(cResult)
       
End Sub

I Can not get below response in my apps
Response.SendString(cResult)

While actually i got the result in the log

Logger connected to: ADVAN ADVAN T5C
--------- beginning of /dev/log/system
--------- beginning of /dev/log/main
Client: 192.168.1.7
/getparameter
{RESULT:OK,
ADDRESS:0,
VALUE:ALCOR_SR}
** Service (serverservice) Destroy **
2020-04-27 04:46:23.357:INFO::stopped o.e.j.s.ServletContextHandler{/,null}
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Ip address: 192.168.1.8
** Activity (main) Resume **
*** Service (serverservice) Create ***
2020-04-27 04:46:50.686:INFO::jetty-7.x.y-SNAPSHOT
2020-04-27 04:46:50.739:INFO::started o.e.j.s.ServletContextHandler{/,null}
2020-04-27 04:46:50.806:INFO::Started [email protected]:2567 STARTING
org.eclipse.jetty.server.Server@421b74b0
** Service (serverservice) Start **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
Client: 192.168.1.7
/getparameter
*** Service (httputils2service) Create ***
** Service (httputils2service) Start **
{RESULT:OK,
ADDRESS:206,
VALUE:1234}

What has been wrong, your help much be appreciated


Tq
 
Last edited:
Top