J j_o_h_n Active Member Licensed User Longtime User Jan 31, 2021 #1 I have two b4j programs, a server and a client The client sends a post request. Using the function PrintAllParameters i am able to retrieve the names and values of both parameters However the GetParameter method just returns empty strings for both. I think there is something wrong with the Text argument I am entering in the Poststring method on the client but I don't know what it is. Code: Copy [CODE=b4x] Dim job As HttpJob 'using jOKHttpUtils2 job.Initialize("job", Me) Dim s As String = "firmid=Y1m & password=$2a$10$CpmIIvM0UqToZcP0iwKO9ugp4zlHwiNU7Pyo4dT1FFB9OfwQizgUO" job.PostString(url,s) Code: Copy Log(PrintAllParameters(req)) 'retrieves both parameters Dim firmid As String = req.GetParameter ("firmid") 'empty string returned Dim Password As String = req.GetParameter("password") 'empty string returned Public Sub PrintAllParameters (req As ServletRequest) As String Dim sb As StringBuilder sb.Initialize sb.Append("<ul>") Dim params As Map = req.ParameterMap For Each name As String In params.Keys sb.Append("<li>").Append(name).Append(":") Dim values() As String = params.Get(name) For Each value As String In values sb.Append(" ").Append(value) Next sb.Append("</li>") Next sb.Append("</ul>") Return sb.ToString End Sub Log output: <ul><li>firmid: Y1m </li><li> password: $2a$10$CpmIIvM0UqToZcP0iwKO9ugp4zlHwiNU7Pyo4dT1FFB9OfwQizgUO</li></ul> Click to expand... Last edited: Jan 31, 2021
I have two b4j programs, a server and a client The client sends a post request. Using the function PrintAllParameters i am able to retrieve the names and values of both parameters However the GetParameter method just returns empty strings for both. I think there is something wrong with the Text argument I am entering in the Poststring method on the client but I don't know what it is. Code: Copy [CODE=b4x] Dim job As HttpJob 'using jOKHttpUtils2 job.Initialize("job", Me) Dim s As String = "firmid=Y1m & password=$2a$10$CpmIIvM0UqToZcP0iwKO9ugp4zlHwiNU7Pyo4dT1FFB9OfwQizgUO" job.PostString(url,s) Code: Copy Log(PrintAllParameters(req)) 'retrieves both parameters Dim firmid As String = req.GetParameter ("firmid") 'empty string returned Dim Password As String = req.GetParameter("password") 'empty string returned Public Sub PrintAllParameters (req As ServletRequest) As String Dim sb As StringBuilder sb.Initialize sb.Append("<ul>") Dim params As Map = req.ParameterMap For Each name As String In params.Keys sb.Append("<li>").Append(name).Append(":") Dim values() As String = params.Get(name) For Each value As String In values sb.Append(" ").Append(value) Next sb.Append("</li>") Next sb.Append("</ul>") Return sb.ToString End Sub Log output: <ul><li>firmid: Y1m </li><li> password: $2a$10$CpmIIvM0UqToZcP0iwKO9ugp4zlHwiNU7Pyo4dT1FFB9OfwQizgUO</li></ul> Click to expand...
Daestrum Expert Licensed User Longtime User Jan 31, 2021 #2 It might be the spaces you added before and after the & try it with Code: Copy Dim s As String = "firmid=Y1m&password=$2a$10$CpmIIvM0UqToZcP0iwKO9ugp4zlHwiNU7Pyo4dT1FFB9OfwQizgUO" Upvote 0
It might be the spaces you added before and after the & try it with Code: Copy Dim s As String = "firmid=Y1m&password=$2a$10$CpmIIvM0UqToZcP0iwKO9ugp4zlHwiNU7Pyo4dT1FFB9OfwQizgUO"
J j_o_h_n Active Member Licensed User Longtime User Jan 31, 2021 #3 Daestrum said: It might be the spaces you added before and after the & try it with Code: Copy Dim s As String = "firmid=Y1m&password=$2a$10$CpmIIvM0UqToZcP0iwKO9ugp4zlHwiNU7Pyo4dT1FFB9OfwQizgUO" Click to expand... Yes that fixed it! Thank you! Upvote 0
Daestrum said: It might be the spaces you added before and after the & try it with Code: Copy Dim s As String = "firmid=Y1m&password=$2a$10$CpmIIvM0UqToZcP0iwKO9ugp4zlHwiNU7Pyo4dT1FFB9OfwQizgUO" Click to expand... Yes that fixed it! Thank you!