how to make my controller accept XML body?
hey guys. i have this controller:
and in my service i have hardcoded small XML. and i want to be able to accept XML and ditch the hardcoded XML in my service. can i use some kind of annotation in my controller? how to aproach it? thanks alot.
8 Replies
⌛
This post has been reserved for your question.
Hey @bambyzas! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
Stack Overflow
How can Spring RestController accept both JSON and XML?
I have a Spring controller that works great:
@RestController
@RequestMapping(value = "/widgets")
class WidgetController {
@RequestMapping(method = RequestMethod.POST)
WidgetResponse create...
Baeldung
Using XML in @RequestBody in Spring REST | Baeldung
Learn how to leverage Jackson XML to use XML within Spring REST.
i thought there were other alternatives too. i knew about this
thanks. ill just use it and wont bother with anything
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
Before your post will be closed, would you like to express your gratitude to any of the people who helped you? When you're done, click I'm done here. Close this post!.
I mean, you can also use other XML parsing mechanisms
Unknown User•6mo ago
Message Not Public
Sign In & Join Server To View
💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.