Java SOAP wrong return XML tag name



I have a SOAP endpoint. Something like this:



@WebMethod
public CarResourceList getAllCars() {
...
CarResources carResources = ...
CarResourceList carResourceList = new CarResourceList(carResources);
return carResourceList;
}


And DTO:



@XmlRootElement(name="cars")
@XmlAccessorType(XmlAccessType.FIELD)
public class CarResourceList {
...
}


However, when I do a request I get XML with wrong tag name:



<S:Envelope xmlns:S="http://ift.tt/sVJIaE">
<S:Body>
<ns2:getAllCarResponse xmlns:ns2="http://ift.tt/1uKwAay">
<return>
<car>
...
</car>
...


Why there is <return> tag instead of <cars>? I do not understand - I have required annotation, but tag is wrong.


No comments:

Post a Comment