Get all updates of Java4s
Follow Us: Email Newsletter

JAX-RS XML Example With JAXB Using Jersey

Web Services » On Jul 25, 2014 { 5 Comments } By Sivateja

In this article i will give you an example on how a RESTful web service produces XML response using Jersey. Basically JAX-RS supports conversion of java objects into XML with the help of JAXB. As Jersey it self contains JAXB libraries we no need to worry about JAXB-Jersey integration stuff.

Steps Need to be Followed

  • Add ‘jersey-server.jar‘ to your Maven pom.xml which includes all JAXB supporting libraries into your class path
  • Annotate your service method with @Produces(MediaType.APPLICATION_XML)

Required Files

  • pom.xml
  • web.xml






You Might Also Like

  ♦ About Author ♦

Full Stack( Java/J2EE & UI/UX ) Developer and founder of Java4s - Get It Yourself, A popular Java/J2EE Programming Blog. Sign-up for the Email Newsletter for your daily dose of Java tutorials.


5 Responses to “JAX-RS XML Example With JAXB Using Jersey”
  1. Pranab Kumar Sahoo says:

    Thanks Sivateja

  2. venu says:

    Can you please post one example on Restful web service security.

  3. varun says:

    Can you please post one example on web services security

  4. vajreshwari says:

    Hi sivateja,

    I want to pass the query parameter as Map<String,List>. can u plz suggest how to pass these parameters.

  5. trinadh says:

    Please send more rest full web services in jersey examples in my mail id ASAP


By posting your answer, you agree to our comments policy.
What would you like to learn today?
Browse these popular technologies
Hibernate spring struts Servlets ajax Log4j jQuery Json Core Java Web Services AngularJs
Most Recent Tutorials
Hibernate_Logo Hibernate Recent Posts Spring_Logo Spring Recent Posts Struts_Logo Struts Recent Posts
Useful Links Current & UpComing Tutorials
  Web Services [ SOAP ], JSP
Contact | About Us | Privacy Policy | Advertise With Us

© 2010 - 2016 Java4s - Get It Yourself.
The content is copyrighted to Sivateja Kandula and may not be reproduced on other websites.