Android Question trouble implement Httpjobs

nickysuwandi

Member
Licensed User
Longtime User
I want to send json and receive json from url. May some genius can tell where wrong oh my code, Thanks.

This my json url

json url login:
curl --location --request POST 'http://192.168.5.80:9090/v1.0/Login/GetLogin' \
--header 'Content-Type: application/json' \
--data-raw '{
    "Hp":"08123456",
    "Pin":"12345"
}'

This my code in b4a

b4a code:
Dim gen As JSONGenerator
    Dim L1 As List
    Dim M1 As Map
    Dim JSONstring As String
    L1.Initialize
    Try
        M1.Initialize
        M1.Put("Hp", "08123456")
        M1.Put("Pin", "12345")
        L1.Add(M1)
        gen.Initialize2(L1)
        JSONstring=gen.ToString
        Dim job As HttpJob
        job.Initialize("login" , Me)
        Dim S As String = "http://192.168.5.80:9090/v1.0/Login/GetLogin"
        job.PostString(s ,  JSONstring)
        job.GetRequest.SetContentType("application/x-www-form-urlencoded")
        job.GetRequest.SetContentType("application/json")
        wait for (job) JobDone (job As HttpJob)
        Dim Map1 As Map
        Dim JSON As JSONParser
        Map1.Initialize
    Catch
        Log(LastException)
    End Try


I always get erorr

Error:
ResponseError. Reason: Internal Server Error, Response: {"Message":"An error has occurred."}
 
Top