Implementing a resource method using JAXB objects for XML content
You can process XML in requests and responses using Java Architecture for XML Binding (JAXB) annotated classes.
About this task
You can use JAXB objects as request entity parameters and response entities with Java™ API for RESTful Web Services (JAX-RS) applications. Instead of transforming XML to and from native Java types in a tedious manner, you can leverage the advantages of using JAXB objects. Even though you can use the javax.xml.transform.Source, java.io.InputStream, or java.lang.String interfaces or even a simple byte array to store the XML either as a request or response entity, JAXB enables easier data binding.
The JAX-RS runtime environment has standard MessageBodyReader and MessageBodyWriter provider interfaces for reading and writing JAXB objects as entities.
By default, the JAX-RS runtime environment attempts to create and use a default JAXBContext class for JAXB classes. However, if the default JAXBContext class is not suitable, then you can supply a JAXBContext class for the application using a JAX-RS ContextResolver provider interface.
Procedure
Results
You have configured your JAX-RS web application to use JAXB classes to consume and produce XML content.