views:

186

answers:

0

I have a situation where the method signature of JAX-RS service looks like...

public Collection<CustomerData> getCustomers() {
   ...
}

The xml generated has the root tag like customerDatas as below

<customerDatas><customer>.....</customer></customerDatas>

I am using JAXB annotations and root element name for CustomerData is customer, but I want to change the "customerDatas" to "customers". Is there any way to do it without using another wrapper object just to hold the collection? I tried with @XmlWrapperElement on the above method, but did not work.

I am expecting the result to be like

<customers><customer>.....</customer></customers>

Thanks in Advance

enter code here