On 24/10/12 18:08, Joe Lin wrote:
Likely. Can you point to me which CXF tests post JSON? I'll see if I can
create a simple war for this matter.
One test is in
org.apache.cxf.systest.jaxrs.JAXRSClientServerBook#testUpdateBookWithJSON,
it is pretty old but it submits:
Http-Method: PUT
Content-Type: application/json; charset=ISO-8859-1
Headers: {Content-Length=[48], content-type=[application/json;
charset=ISO-8859-1], Host=[localhost:9002], User-Agent=[Jakarta
Commons-HttpClient/3.1]}
Payload: {"Book":{"id":"123","name":"CXF in Action - 3"}}
and it is processed by
org.apache.cxf.systest.jaxrs.BookStore:
@PUT
@Path("/bookswithjson/")
@Consumes("application/json")
public Response updateBookJSON(Book book) {
}
Cheers, Sergey
Thanks.
Joe
On 10/24/12 1:37 AM, Sergey Beryozkin wrote:
On 23/10/12 18:05, Joe Lin wrote:
Yes. I got it resolved by going back to 2.6.1.
Sorry I was not able to put our companies war file in Jira. But this
should be some obvious bug in 2.7.0 and easily reproducible.
I was not expecting the private war attached. FYI, those CXF tests
which post JSON pass. So, if you'd like the issue be investigated -
please consider creating a basic project (Maven-based if possible)
that can help me reproduce the issue. To be honest I suspect a
deployment issue of some sort
Cheers, Sergey
Joe
On 10/23/12 3:42 AM, Sergey Beryozkin wrote:
Joe, did you get it resolved ?
Sergey
On 22/10/12 22:42, Sergey Beryozkin wrote:
Hi
On 22/10/12 22:20, Joe Lin wrote:
Hi,
I'm using cxf 2.7.0. And this used to work in 2.6.1.
I tried to send a json object via HTTP PUT using HttpClient. I set
the at
content type from the client with ContentType.APPLICATION_JSON.
But I'm
getting HTTP 415 from tomcat with:
WARNING: No message body reader has been found for request class
SystemConfig, ContentType : application/json;charset=UTF-8
WARNING: javax.ws.rs.WebApplicationException
at
org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBody(JAXRSUtils.java:1109)
Here is the object:
@XmlRootElement(name="system_config")
public class SystemConfig extends Packable {
private String managementIp;
}
And here is the service:
@PUT
@Path("/oob/config/set")
@Consumes(MediaType.APPLICATION_JSON)
public void setSystemConfig(SystemConfig config) {
logger.debug("setting system config:" + config);
// more code
}
Any reason why cxf cannot find application/json message body
reader? In
cxf 2.6.1 I did not have to configure any json reader or provider to
make this work.
Can you please open a JIRA and attach the war there ?
Thanks, Sergey
Thanks for any help.
Joe