I am sending XML data as content type text/xml via a POST to an XPage, but I am unable to locate the data from within the XPage. param.ToString() just returns "{}". param will return parameters in the URL, however. This is the sever-side javascript in the afterRenderResponse event for the Xpage (rendered="false"):
var extCont = facesContext.getExternalContext();
var pageOutput = facesContext.getResponseWriter();
var pageResponse = extCont.getResponse();
pageResponse.setContentType("text/xml");
pageResponse.setHeader("Cache-Control", "no-cache");
//Get data from POST
var data = param.toString();
//echo back what was POSTed
pageOutput.write(data);
pageOutput.endDocument();
facesContext.responseComplete();
All that is returned for var data is "{}" How do I access the XML data that was posted?
The XML data was posted via a LotusScript agent that does work when I have used it to post to another API (not developed in Notes):
xmldata = "<tag>TEST</tag>"
Set httpObject = CreateObject("MSXML2.ServerXMLHTTP")
httpURL = baseURL + "/echoxml.xsp"
Call httpObject.open("POST", httpURL, False)
Call httpObject.setRequestHeader("Content-Type", "text/xml")
Call httpObject.send( xmldata )
httpStatus = httpObject.Status
Print "Status = "+CStr(httpStatus)
I do get a status code of 200 indicating a successful POST.
Where is the data in XPages? Thanks in advance.