Is it possible to Publish a POST REST Service which accepts xml data in request body?

I have one Rest Service which works when I pass JSON data in the input request body but when I pass XML it doesn’t work. I’m not able to find why. The  import mapping which is configured in request body is created from message definition. So Could anyone please help me where is it doable or not and if it is doable then what I’m missing?
2 answers

Have a look at this documentation. Maybe it has to do with the import mapping not being from a Message Definition or the ContentType went with the request. Import Mapping

For a body parameter, you can select an import mapping that converts the body of the request into an object. All object and list parameters except file documents must have an import mapping selected.

To select an import mapping, double-click the parameter or click Edit in the grid after you select the parameter. When selecting the import mapping, you can also choose the commit behavior of the mapping: you can choose to either commit, commit without events, or not commit imported objects.

You can select an import mapping that takes no parameter, or an import mapping that takes a primitive parameter (for example, string, integer). If you select an import mapping with a primitive parameter, you need to have exactly one path parameter with the same type. That path parameter will be passed to the import mapping.

You can indicate what should happen if no object was found when the import mapping has checked the box decide this at the place where the mapping gets used.

If you select an import mapping that supports both XML and JSON (for example, a mapping that is based on a message definition), then the operation will be able to handle both XML and JSON requests.

Valid requests must contain a Content-Type header. See Recognized media types for a list of media types that are understood by the import mapping. If an unsupported content type is used, the operation will result in a “400 Bad Request” response.

The import mapping is also used to generate object schemas for operation responses in OpenAPI (Swagger) documentation page based on JSON Schema


YES ,It is Possible

If you are work on REST  API

Based On Annotation Configuration 

Spring 4.0 Version Supports @RESTController that Supports Different Data formats like JSON , HTML ,XML,TEXT