Hi
We are trying to post data to a webservice url using odata4j and we are following CSRF token validation failed error. The code we are currently using is
ODataConsumer.Builder builder = ODataConsumers.newBuilder(url to which post is to be done);
builder.setClientBehaviors(new BasicAuthenticationBehavior(username,password));
ODataConsumer c = builder.build();
.properties(OProperties.string("ID", "57"))
.execute();
ODataConsumer.dump.all(true);
I guess the problem here is the header to which I should add the CSRF token and I am looking for a way to add headers to ODataConsumer. I have also tried ODataClientRequest with which I am able to add headers but adding Entity is causing problems. The code is
clientRequest.header("X-CSRF-Token", "OcjGKcE-kYF3MmNvaklKqg==");
BasicAuthenticationBehavior bs = new BasicAuthenticationBehavior(username,password);
Here we are not able to create entity which is to be posted to the webservice url.
Please provide a solution.
Thanks and Regards
Jaidish hari raj P M