Hi all,
I have a quite silly question, probably due to my inexperience with CXF.

Basically, in Syncope we have a set of CXF services producing both XML and JSON (via Jackson).

At high level, I have troubles when reading JSON payload, via WebClient; the same input string (received as Payload), when given to a bare Jackson's ObjectMapper instance, works like a charm.

More in detail, the CXF service configuration is the one at [1].

When issuing, with header "Accept: application/json", an HTTP GET /syncope/cxf/schemas/user/NORMAL/fullname (e.g. read() as defined at [2]), it returns

{
  "name": "fullname",
  "type": "String",
  "mandatoryCondition": "true",
  "enumerationValues": null,
  "enumerationKeys": null,
  "multivalue": false,
  "uniqueConstraint": true,
  "readonly": false,
  "conversionPattern": null,
  "validatorClass": null
}

which looks correct; in fact I am easily able to deserialize such input via

        ObjectMapper mapper = new ObjectMapper();
SchemaTO actual = mapper.readValue(writer.toString(), SchemaTO.class);

but when I try to use WebClient for accessing the same read() method I get stuck with

ClassCastException: java.util.LinkedHashMap cannot be cast to org.apache.syncope.common.to.AbstractSchemaTO

which looks definitely like a Jackson exception.

For additional reference, here is my client's Spring configuration [3] (see 'restClientFactory') and the AbstractSchemaTO [4] and SchemaTO classes [5].

Nevertheless to say, switching to "Accept: application/xml" makes everything work again.

I am using CXF 2.7.6-SNAPSHOT (this in order to be able to use Jackson 2.2.2).

Any hint?

Regards.

[1] https://svn.apache.org/repos/asf/syncope/trunk/core/src/main/resources/restContext.xml [2] https://svn.apache.org/repos/asf/syncope/trunk/common/src/main/java/org/apache/syncope/common/services/SchemaService.java [3] https://github.com/ilgrosso/syncopeRestClient/blob/master/src/main/resources/applicationContext.xml [4] https://svn.apache.org/repos/asf/syncope/trunk/common/src/main/java/org/apache/syncope/common/to/AbstractSchemaTO.java [5] https://svn.apache.org/repos/asf/syncope/trunk/common/src/main/java/org/apache/syncope/common/to/SchemaTO.java

--
Francesco Chicchiriccò

ASF Member, Apache Syncope PMC chair, Apache Cocoon PMC Member
http://people.apache.org/~ilgrosso/

Reply via email to