Hi Francesco
On 27/11/13 14:00, Francesco Chicchiriccò wrote:
On 27/11/2013 14:55, Sergey Beryozkin wrote:
Hi Francesco,
On 27/11/13 11:36, Francesco Chicchiriccò wrote:
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?
It actually exposes the fact the existing issue, I've had a test
working with a primitive value but for whatever reasons (copy & paste
most likely) HTTP Client was used to read String and test it for
"true" as apposed to using WebClient or Proxy to cast it to primitive
'boolean'.
I've refactored the client code a lot in 3.0.0 to consolidate all the
reading of responses in Response.readEntity and it will work with CXF
webClient, Proxy, Response itself and new Client API, but the lack of
tests got the introduced proxy related issue missed,
I've just fixed it, thanks
Thanks Sergey: shall I move to 3.0.0-SNAPSHOT (e.g.
http://svn.apache.org/repos/asf/cxf/trunk/)?
I guess we will need few weeks at least to get milestone1 stressed
before targeting the milestone2 release.
Updating to Integer should be a backward compatible change in Syncope,
though I still have to check a WADL issue
Thanks, Sergey
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
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com