I am having problems with unmarshall nested xml below. Can someone please tell me if I missed something.
The tag bodycan contain any anonymous Jaxb object.
Should I create a custom adapter to sort / disassemble such xml?
XML input
<?xml version="1.0" encoding="UTF-8"?>
<serviceRq xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="serviceRq">
<body>
<createRq>
<id>1234</id>
</createRq>
</body>
</serviceRq>
My annotated Jaxb classes:
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "serviceRq")
public class ServiceRq{
private Object body;
}
Here the body can be any jaxb annotated object, in this case its CreateRq.
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "createRq")
public class CreateRq{
private String id;
}
I am looking for a general way to support any annotated Jaxb object in an xml input body.
source
share