othman
othman

Reputation: 4556

Grails populate params with XML from POST request

I have a RestFull grails api that i expose through grails Controller. I need to automatically bind the xml data sent in a POST request. I don't think using groovy bindData(object,params) works as the params reference seems not having the xml elements. i use the parseRequest=true in the UrlMappings but yet the params Object does'nt have the xml elements.

am i missing some other config so that my params object get automatically populated with the xml body elements?

Upvotes: 2

Views: 3557

Answers (2)

othman
othman

Reputation: 4556

it seems the right way to do it is to use:

request.reader.text

to get the raw xml. the other methods were not successfull for me.

Upvotes: 7

Grooveek
Grooveek

Reputation: 10094

request.XML is the object holding the Elements parsed from the XML request

Have a look at the request variable available to your controllers.

Upvotes: 1

Related Questions