1 year ago

#385601

test-img

StudentOfTheGame

Implementing a CXF JAX-RS client with JSON request

I am trying to develop a client where i will perform a POST operation and pass a json in the service request.

Checking CXF's official documentation i found the code snippet below:

Client client = ClientBuilder.newBuilder().newClient();
WebTarget target = client.target("http://localhost:8080/rs");
target = target.path("service").queryParam("a", "avalue");
 
Invocation.Builder builder = target.request();
Response response = builder.get();
Book book = builder.get(Book.class);

I understand that the request here is "a", "avalue". How can i tweak this code in order to pass a json string as the request?

java

web-services

jax-rs

cxf

cxf-client

0 Answers

Your Answer

Accepted video resources