Open GoogleCodeExporter opened 9 years ago
Could you please try out the latest snaphot, 2.3.5-SNAPSHOT after having
depended on the following repo:
<repositories>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<snapshots />
</repository>
</repositories>
to see if it works better?
Original comment by johan.ha...@gmail.com
on 14 Oct 2014 at 1:10
Hi, just tried the fix, exception is no more thrown and the XML payload is
converted into an object of the declared type, however no fields in the object
are set, all having null value after deserialization.
I guess this is an issue on my site, because I am using a generated .jar module
with DTOs, which are generated by the enuncicate tool. They annotated with
@JsonFoo annotations from Jackson, and perhaps this is not the way to go.
Now I will try a second generated .jar module (again from enunciate), where the
DTOs are annotated with @XmlFoo annotations from JAXB. The goal is to be able
to use both XML and JSON as a transfer format, with the same set of DTOs
(either with @JsonFoo or @XmlFoo annotations). Am I guessing right, that the
JAXB annotations are the right way to go for this scenario?
Original comment by rfili...@gmail.com
on 16 Oct 2014 at 9:23
I was able to serialize both JSON and XML using JAXB-annotated classes in
combination with the Jackson 1.9.3 serializer. The trick is to register another
AnnotationIntrospector, which is capable of inspecting JAXB annotations.
ObjectMapperConfig objectMapperConfig = ObjectMapperConfig.objectMapperConfig() .jackson1ObjectMapperFactory(new JaxbObjectMapperFactory());
RestAssured.config = RestAssured.config()
.objectMapperConfig(objectMapperConfig);
public class JaxbObjectMapperFactory implements Jackson1ObjectMapperFactory {
@Override
public ObjectMapper create(Class cls, String charset) {
ObjectMapper mapper = new ObjectMapper();
AnnotationIntrospector introspector = new JaxbAnnotationIntrospector();
mapper.setDeserializationConfig(mapper.getDeserializationConfig()
.withAnnotationIntrospector(introspector));
mapper.setSerializationConfig(mapper.getSerializationConfig().withAnnotationIntrospector(introspector));
return mapper;
}
}
More information can be found on the Jackson website
http://wiki.fasterxml.com/JacksonJAXBAnnotations
I will try out more complex scenarios in the next days and give feedback if any
issues arise.
Original comment by rfili...@gmail.com
on 16 Oct 2014 at 1:20
Thanks a lot for helping out and investigating. Tell me if there's anything we
should do on the REST Assured side to make it simpler..
Original comment by johan.ha...@gmail.com
on 16 Oct 2014 at 2:11
we are still using 2.3.4. Is there a work around until we get a latest version?
Original comment by c.k.chai...@gmail.com
on 10 Nov 2014 at 9:05
rfilipov just mentioned the workaround. No changes have been made in REST
Assured.
Original comment by johan.ha...@gmail.com
on 11 Nov 2014 at 6:10
Original issue reported on code.google.com by
rfili...@gmail.com
on 13 Oct 2014 at 6:01Attachments: