I'm developing a system that specification says that the entity XML traveled through the web service controller endpoints must be like this:
<SAAF>
<vehicle>
<Information>
<Quantity>3</Quantity>
</Information>
<Entry>
[... entry variables ..]
</Entry>
<Entry>
[... entry variables ..]
</Entry>
<Entry>
[... entry variables ..]
</Entry>
</vehicle>
</SAAF>
But, I only managed to do this:
<SAAF>
<vehicle>
<information>
<quantity>3</quantity>
</information>
<entries>
<entry>
[...entry variables...]
</entry>
<entry>
[...entry variables...]
</entry>
<entry>
[...entry variables...]
</entry>
</entries>
</vehicle>
</SAAF>
This is the VehicleRoot class:
import lombok.Data;
@Data
@XmlRootElement(name = "vehicle")
@XmlType(propOrder = { "Information", "Entries" })
public class VehicleRoot implements Serializable {
private static final long serialVersionUID = 1L;
private Information Information;
private List<Entry> Entries;
}
1 - Is possible to send the <Entry></Entry> objects tags without wrapping them inside the "entries" list?
2 - Can I configure Spring to return the tags with capitalized name? "Entry" instead of "entry"? Is this even possible? I managed to do this by adding @JsonNaming(PropertyNamingStrategy.UpperCamelCaseStrategy.class) annotation in the VehicleRoot class
I would like to be able to change the system specification, but I'm afraid that I won't be able to do that...