Marshalling entities with the same root name
I am in a project where we're building synchorization services to an external system using RESTful web service calls through RestTemplate. The external system gives us three entities: places, events and members, through three different uri's. The problem is that the XML-structure for all three entities has the top-level tag "<xml>", so we end up having three jaxb2 classes with @XmlRootElement(name="xml") which causes a problem when the information is marshalled. The marshaller fails because it can't figure out which <xml>-structure is coming.
We are using Http message converters with a jaxb2 marshaller set up like this:
This is how the web service call is made:
<beans:bean id="jaxb2Marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
The preferred solution would of course be to solve the issue at the root and deliver xml with different tag names or have them qualified with name spaces, but there is now way we can have any changes made there.
String url = ConstantHelper.MY_URI_BASE + ConstantHelper.MY_PLACES_URL + urlParameters;
EventXml eventList = restTemplate.getForObject(url, EventXml.class);
So can someone please suggest a good way to solve this?