SOAP веб-сервис возвращается как список объектов - PullRequest
0 голосов
/ 10 марта 2020

У меня проблемы с попыткой создать веб-сервис, который возвращает объект со списком в нем. Я надеюсь, что кто-то может помочь мне, потому что мне нужна эта услуга, как только возможно

@WebService(serviceName = "MTAWS", targetNamespace = "ws.aegir.cl")
@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
public class MTAWS {
@WebMethod(operationName = "obtenerOperaciones", action = "obtenerOperacionesAction")
    public MTAListResponse obtenerOperaciones(@WebParam(name = "idUsuario")String idUsuario) {
....}
}

класс ответа

public class MTAListResponse implements Serializable{
   private List<OperacionVO> operaciones; 
   //getter and setters
}

pojo

@XmlRootElement(name= "Operacion", namespace="ws.aegir.cl")
public class OperacionVO implements Serializable{
  private int id;
  //getter and setters
}

, когда я потребляю WS я получаю

< ns2:obtenerOperacionesResponse xmlns:ns2="ws.aegir.cl">
    < return>
     < operaciones>
       < id>1< /id>
     < /operaciones>  
     < operaciones>
       < id>2< /id>
     < /operaciones>
    < /return>
< /ns2:obtenerOperacionesResponse>

Но я ожидал

< ns2:obtenerOperacionesResponse xmlns:ns2="ws.aegir.cl">
 < return>
  < operaciones>
     < operacion>
       < id>1< /id>
     < /operacion>  
     < operacion>
       < id>2< /id>
     </operacion>
  < /operaciones>
 < /return>
< /ns2:obtenerOperacionesResponse>

Как я могу добавить тег "Operacion" в ответ?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...