Search code examples
httprequestlotus-dominolotusscript

Query_String / Query_String_Decoded don't hold Post Parameters


I have an Agent which should accept Post parameters, sent from An App in Titanium,

In the App i send a httprequest, e.g:

var params = {
"Param1":"Test",
"Param2":"Sth"
}
var http = Ti.Network.createHTTPClient()
  http.open("POST","server/db.nsf/agent?OpenAgent",true);
  http.setRequestHeader('Authorization', 'Basic ' + Ti.Utils.base64encode(username + ':' + password));

  http.send(params)
    http.onreadystatechange = function () {
      var response = http.responseData
          callback(response)
    }

And in the Agent i have the following Code:

Dim session As NotesSession
Dim doc As NotesDocument

Set doc = session.DocumentContext

Print (doc.Query_String(0))
Print (doc.Query_String_Decoded(0))

I also added 2 hidden, computed forms Query_String and Query_String_Decoded with its name as value Just to make sure.

And tried `@UrlQueryString``

But the responseData is only the OpenAgent parameter from the Url

Could anyone help me to find the right way to get the Post Data, sent from the httprequest

Thanks for your help in Advance


Solution

  • You need to use the Request_Content CGI variable and not Query_string.


    You could also use XPages and create an XAgent instead. Values posted to XPages can be read using param.get(). I have written a blog post about a HTTP request consumer in XPages that you can use as inspiration.