I need to output an XML file from one application to another, but I’d like not to have to write this XML somewhere and then reading this file on the other application.
Both are Java applications and (so far!) I’m using XStream.
How can I do it?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Note: I’m the EclipseLink JAXB (MOXy) lead and a member of the JAXB (JSR-222) expert group.
JAXB (JSR-222) is the default binding layer for The Java API for RESTful Web Services (JAX-RS). This means you can just create a service that returns POJOs and all the to/from XML conversion will be handled for you.
Below is an example JAX-RS service that looks up an instance of
Customerusing JPA and returns it to XML. The JAX-RS implementation will leverage JAXB to do the actual conversion automatically.Full Example