Android Question issue with HttpJob postString

Alrikh

Member
Hello guys, how are you?

I need send a simple form on a server, i have found this code in a sample proj.. but something not work very well. :p
on the server arrive a request but without any params/forms/queries

something escape away from me ?
any idea?

B4X:
Dim post As Map = CreateMap("u": $"${dData.ServerUserName}"$, "p": $"${dData.ServerPassword}"$, "cmd" : "get")
    Dim JSONGenerator As JSONGenerator
    JSONGenerator.Initialize(post)
    Dim Job As HttpJob
    Job.Initialize("Tablet", Me)
    Log(JSONGenerator.ToString)
    Job.Username = "tdl-App"
    
    Job.PostString(dData.Server & "/request/tdl.ashx", su.EncodeUrl(JSONGenerator.ToString, "UTF8"))

    Job.GetRequest.SetContentType("application/json")

    Wait For (Job) JobDone(Job As HttpJob)
    
    If Job.Success Then
    ....
    else
    ....
    end if
 

Alrikh

Member
Thanks Erel for tips.

I have found the issue, in aspx i must declare correctly content type if i want the post data propriety populate

B4X:
Job.GetRequest.SetContentType("application/x-www-form-urlencoded")
 
Upvote 0
Top