MVC Spring : Can we get the XML response if I passed json parameters in body for post request? -


i did google around got few link described, cannot xml response if passed parameters body post request. please confirm, possible in spring? if yes please share annotation or related hint can forward on it. appreciated.

you can use requestmapping annotation. have produces element specifies type of returned response. if force xml return type use that

@requestmapping(value="/someresource",                  method=requestmethod.post,                  produces=mediatype.application_xml) 

another example - if consume json , xml, return xml:

@requestmapping(value="/someresource",                  method=requestmethod.post,                 consumes={mediatype.application_xml, mediatype.application_json},                 produces=mediatype.application_xml) 

Comments