Android Question Httputils2 HttpJob Issue

Gobat

New Member
Licensed User
Hi,

I'm new on B4A, I have an issue with HttpJob. Here is my code :

B4X:
Sub JobDone(job As HttpJob)

        Log("Error: " & job.ErrorMessage)

        If (job.JobName = "Job") Then
           
                    If job.Success Then

                    End if

           
        else if job.JobName = "getnonce" Then
           
            If Not(job.Success) Then
               
                ToastMessageShow("Unknown Error", True)
                Return
               
            End If
           
           
           
            Dim parser As JSONParser 
            parser.Initialize(job.GetString)
            Dim root As Map = parser.NextObject 
            Dim controller As String = root.Get("controller") 
            Dim method As String = root.Get("method") 
            Dim nonce As String = root.Get("nonce") 
            Dim status As String = root.Get("status")
           
            Main.UserNonce = nonce
           
            SignUpUser_Job.Download2("http://myURL", Array As String("nonce", Main.UserNonce, "username", Main.utenteUsernameTemp,"user_pass",Main.utentePasswordTemp))
           
           
           
           
        Else if job.JobName = "signup" Then
           
            If Not(job.Success) Then

                ToastMessageShow("Unknown Error", True)
                Return
               
            End If
           
           
            Dim stringa As String = job.GetString
           
            Log(stringa)                     
        End If
     
         
End Sub

The problem is, when I call :

B4X:
SignUpUser_Job.Download2("http://myURL", Array As String("nonce", Main.UserNonce, "username", Main.utenteUsernameTemp,"user_pass",Main.utentePasswordTemp))

and I try to sign Up to my website, and I try to use a Username that is already in use, server response is : {"status":"error","error":"Username already exists."}

but i'm not able to get this response in B4A via HttpJob, because job.success is False and job.Errormessage is : Error: Not Found.

Can you help me ?

How can I get a String of the server Response when the Status is Error ?

Thank you
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

Gobat

New Member
Licensed User
server response is : {"status":"error","error":"Username already exists."}

but i'm not able to get this response in B4A via HttpJob, because job.success is False and job.Errormessage is : Error: Not Found.

log(Job.ErrorMessage)

Thanks for the reply, but that is the issue, Job.ErrorMessag is "Not Found" but the server Response is : {"status":"error","error":"Username already exists."}
 
Upvote 0
Top