Actually I was curious for the code since it seems like he's referencing XML in the error, but sending JSON.
On Mon, Feb 24, 2014 at 3:10 PM, Romain Manni-Bucau <rmannibu...@gmail.com> wrote: > cause default provider is using jaxb model so it needs a wrapper. > Jackson doesnt. (see jettison) > > Side note: you can put this conf in openejb-jar.xml > Romain Manni-Bucau > Twitter: @rmannibucau > Blog: http://rmannibucau.wordpress.com/ > LinkedIn: http://fr.linkedin.com/in/rmannibucau > Github: https://github.com/rmannibucau > > > > 2014-02-24 21:00 GMT+01:00 José Luis Cetina <maxtorz...@gmail.com>: >> Hi @John, the problem is in the @XmlRootElement, Jackson provider doesn't >> need it, then i just add Jackson as a provider and everything works. >> >> >> But i dont understand why with the default provider this doesn't work. >> >> >> I add the jackson dependecy and >> the >> -Dcxf.jaxrs.providers=com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider >> property. :) >> >> >> 2014-02-24 13:47 GMT-06:00 John D. Ament <john.d.am...@gmail.com>: >> >>> 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 >>> >> >> >> >> -- >> ------------------------------------------------------------------- >> *José Luis Cetina* >> -------------------------------------------------------------------