Hi,
I am in the middle of migrating Apache Syncope trunk from CXF 2.7.8 to
3.0.0-milestone1.
By following [1] and [2] it has been quite straightforward to make
almost everything working, with some exceptions: it seems that
proxy-based clients are not able any more to handle primitive type results.
For example, when calling UserService#count [3], the proxy-based client
raises (Content-Type XML or JSON does not make any difference):
[main] ERROR org.apache.cxf.jaxrs.utils.JAXRSUtils - Problem with
reading the data, class int, ContentType: application/xml;charset=UTF-8.
Exception in thread "main"
javax.ws.rs.client.ResponseProcessingException: Problem with reading the
data, class int, ContentType: application/xml;charset=UTF-8.
at
org.apache.cxf.jaxrs.impl.ResponseImpl.reportMessageHandlerProblem(ResponseImpl.java:431)
at
org.apache.cxf.jaxrs.impl.ResponseImpl.doReadEntity(ResponseImpl.java:381)
at
org.apache.cxf.jaxrs.client.AbstractClient.readBody(AbstractClient.java:487)
at
org.apache.cxf.jaxrs.client.ClientProxyImpl.handleResponse(ClientProxyImpl.java:688)
at
org.apache.cxf.jaxrs.client.ClientProxyImpl.doChainedInvocation(ClientProxyImpl.java:639)
at
org.apache.cxf.jaxrs.client.ClientProxyImpl.invoke(ClientProxyImpl.java:215)
at com.sun.proxy.$Proxy21.count(Unknown Source)
at net.tirasa.syncoperestclient.App.main(App.java:260)
Caused by: java.lang.ClassCastException: Cannot cast java.lang.Integer
to int
at java.lang.Class.cast(Class.java:3084)
at
org.apache.cxf.jaxrs.impl.ResponseImpl.doReadEntity(ResponseImpl.java:379)
Am I missing something?
TIA
Regards.
[1]
https://cwiki.apache.org/confluence/display/CXF20DOC/JAX-RS#JAX-RS-FromCXF2.7.xtoCXF3.0.0
[2] https://cwiki.apache.org/confluence/display/CXF20DOC/JAX-RS+Client+API
[3]
https://svn.apache.org/repos/asf/syncope/trunk/common/src/main/java/org/apache/syncope/common/services/UserService.java
--
Francesco Chicchiriccò
Tirasa - Open Source Excellence
http://www.tirasa.net/
ASF Member, Apache Syncope PMC chair, Apache Cocoon PMC Member
http://people.apache.org/~ilgrosso/