Can you post the code for your resource?

On Mon, Feb 24, 2014 at 2:05 PM, José Luis Cetina <maxtorz...@gmail.com> wrote:
> Hi, im doing my first rest service. Im having problem's with retrieving the
> json data, when my method is called i get an:
>
> WARNING: javax.xml.bind.UnmarshalException
>  - with linked exception:
> [com.sun.istack.SAXParseException2; columnNumber: 0; unexpected element
> (uri:"", local:"id"). Expected elements are <{}conektaEvent>,<{}data>]
> at
> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:435)
>
>
> Do im missing something, any advice?
>
>
> Here is the json object that im trying to receive me in the post method:
>
> {
>   "id":"521154c132611f5bc0000029",
>   "type":"charge.paid",
>   "created_at":1376867521,
>   "data":{
>     "object":{
>       "id":"521154c032611f5bc0000028",
>       "object":"charge",
>       "livemode":false,
>       "created_at":1376867520,
>       "status":"paid",
>       "currency":"MXN",
>       "description":"Autocinema Coyote - Eterno resplandor de una mente sin
> recuerdos",
>       "reference_id":"XXYYZZ-TEST1234",
>       "failure_code":"",
>       "failure_message":null,
>       "amount":20000,
>       "paid_at":1377021230,
>       "fee":1160,
>       payment_method":{
>         "object":"bank_transfer_payment",
>         "service_name":"Conekta",
>         "service_number":"127589",
>         "type":"banorte",
>         "reference":"0007131"
>       },
>       "details":{
>         "name":"Gustavo Delgado",
>         "phone":5555555555,
>         "email":"gustavo.delg...@gmail.com"
>       }
>     },
>     "previous_attributes":{
>       "status":"pending_payment",
>       "paid_at":1377021230
>     }
>   }
> }
>
>
>
> Pojo:
>
> @XmlAccessorType(XmlAccessType.FIELD)
> @XmlRootElement()
> public class ConektaEvent implements Serializable{
>
>     @XmlAttribute(name="id")
>     private String id;
>     @XmlAttribute(name="type")
>     private String type;
>     @XmlElement(name="created_at")
>     private Timestamp createdAt;
>     @XmlElement(name="data", type = ConektaData.class)
>     private ConektaData data;
>
>     public ConektaEvent() {
>     }
>
>     //getters and setters
> }
>
>
> I have a /WEB-INF/resources.xml
>
> <?xml version="1.0" encoding="UTF-8"?>
> <resources>
>     <Service id="json"
> class-name="org.apache.cxf.jaxrs.provider.json.JSONProvider">
>         SkipJaxbChecks = true
>         DropRootElement = true
>         SupportUnwrapped = true
>         SingleJaxbContext = true
>     </Service>
> </resources>
>
>
>
> Im newbie in jax-rs any help will be appreciated.
>
> Im using TomEE 1.6.0 JAX-RS

Reply via email to