How to send data through a post in the url (using ws (url) .post ()) and how to manipulate that data in the same application
I'm using ws.
and this code to send message via post
public class WebService implements WSBodyReadables, WSBodyWritables {
private final WSClient ws;
@Inject
public WebService(WSClient ws) {
JsonNode json = Json.newObject()
.put("key1", "value1")
.put("key2", "value2");
}
// ...
}
and I want to receive this data in the controller, I am using this code:
public class WebServiceController extends Controller{
@Inject WSClient ws;
@Inject
Materializer materializer;
private Server server;
private Content response;
public CompletionStage<Result> web() {
ok("Feed title: " + response.asJson().findPath("title").asText())
);
}
}
But I get this error when accessing the url
'CompletionException: java.lang.RuntimeException: Error parsing JSON from WS response wsBody'
I'm new to playframework, I need to do a webservice where I can give a post with some information, and then access that url and capture that information. Please help me