Read Content Body on a HTTP Post

Read Content Body on a HTTP Post

  

Hi Community,

How can i get and Read the Content that comes in in the body of an http Post?

i.e: Server A on page /.../TestA.aspx is an action that makes an Http Post to Server B /.../TestB.aspx with a "Data" and an XML based inside.


When Accessing server B, page TestB.aspx i need to get and read the xml based that was on the Post. 

I've tried the HTTPGet and also GetRequestContent, but none of them i could read the body.


Thanks in advance,

Best Regards,

Andrew Tabata

Hi Andrew,


Any ready why you are not using REST API's instead of screens? It would be easier.

What do you want the TestB page to do with the information?


(But answering your question: GetRequestContent should be able to return the content of the submitted post)


Regards,
João Rosado

Hi João,

I am having the same problem. If I use GetRequestContent in my REST API method then I do not see the JSON in the HTTP Post body, although I can see the Headers.

I can get hold of the body by implementing an OnRequest handler so I know the data has been received. My use case is to persist the entire JSON body of the request along with a couple of fields extracted from the request. This would be much simpler to implement in the method's action, if GetRequestContent worked.

This is the Java stack, BTW.

Do you have any suggested about how I can make this work nicely?

Thanks,

Myles

Hi Myles,


GetRequestContent is not prepared to work outside Web Screens, so the behavior of that action inside REST APIs is not reliable.

If your purpose is just recording the information that is one of the use cases that OnRequest was designed for, so that should be the correct place to do it.


Regards,
João Rosado