You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by asookazian <as...@gmail.com> on 2015/03/17 00:11:08 UTC
example for RESTful client using JSON input and POST
Please advise a good example for RESTful client using cxf/JAX-RS, JSON input
and POST.
So far, I've attempted the following but hitting a ClassNotFoundException
for a ClientException class so I'm unable to determine what the problem is
with the 2nd line of code:
String input =
"{\"foo\":\""+foo+"\",\"bar\":\"bar\",\"baz\":"+"\""+baz+"\",\"bah\":"+"\""+bah+"\"}";
WebClient wc = WebClient.create("http://" + server + ":" + port +
"/myRoot");
wc.path("customers/" + a + "/" + b + "/relations");
wc.accept("application/json").type("application/json");
Response r = wc.post(input);
Is this the correct way of passing the JSON input as a String in the post
call to the JAX-RS web method?
--
View this message in context: http://cxf.547215.n5.nabble.com/example-for-RESTful-client-using-JSON-input-and-POST-tp5755148.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: example for RESTful client using JSON input and POST
Posted by asookazian <as...@gmail.com>.
This code works fine after I deploy bundle with RESTful client to Karaf and
run ant target to invoke RESTful client.
--
View this message in context: http://cxf.547215.n5.nabble.com/example-for-RESTful-client-using-JSON-input-and-POST-tp5755148p5755152.html
Sent from the cxf-user mailing list archive at Nabble.com.