users@jersey.java.net

[Jersey] Please help, problem mapping web service classes pojo jersey

From: Alberto Marqués <zerouno.dev_at_gmail.com>
Date: Sun, 5 Oct 2014 18:34:24 +0200

Can anyone help :(

When running from java web service returns me an xml but map it on pojo class
or vo class. I have this exception

Class has two properties of the same name "date_add"
    this problem is related to the following location:
        at public java.lang.String
distrito2presta.Model.Pedido.getDate_add()
        at distrito2presta.Model.Pedido
        at distrito2presta.Model.Pedido
distrito2presta.Model.PrestaPedido.pedido
        at distrito2presta.Model.PrestaPedido
    this problem is related to the following location:
        at public java.lang.String distrito2presta.Model.Pedido.date_add
        at distrito2presta.Model.Pedido
        at distrito2presta.Model.Pedido
distrito2presta.Model.PrestaPedido.pedido
        at distrito2presta.Model.PrestaPedido

Client Java
================

    ClientResponse response =
service.path(m.Path()).path(m.Model().id.toString()).type(MediaType.TEXT_XML).get(ClientResponse.class);

            if (sucess(response.getStatus())){
                Sincro.LOG.info(response.toString());
                Model model = null;
                PrestaPedido oPrestaPedido = null;
                try{
                    oPrestaPedido = (PrestaPedido)
response.getEntity(m.getClass());
                }catch(Exception e){
                    System.out.println("Error al
getEntity::"+e.getMessage());
                }
                return model;
                //return m.Model();


XML return
===========
    <prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
    <order>
    <id>
    <![CDATA[ 1 ]]>
    </id>
    <date_add>
    <![CDATA[ 2014-08-22 16:26:15 ]]>
    </date_add>
    </order>
    </prestashop>

Class VO
=============
    import org.eclipse.persistence.oxm.
annotations.XmlCDATA;

    import javax.xml.bind.annotation.XmlRootElement;

    @XmlRootElement(name="prestashop")
    public class Pedido {

        @XmlCDATA public Integer id=null;
        @XmlCDATA public String date_add=null; //Fecha
creación

    }