0

URL is : http://xx.xx.xx.xx:9080/myprocess?action=start&params={\"inputName\":\"Test\"}

In the above URL my JSON String is {\"inputName\":\"omsai\"}

I am calling the Apache Wink Rest(POST) call in the following way, but it is not working. I am getting java.net.URISyntaxException .

 secHandler.setUserName(userName);
 secHandler.setPassword(passWord);
 secHandler.setSSLRequired(false);

 ClientConfig clientConfig = new ClientConfig();
 clientConfig.handlers(secHandler);
 RestClient restClient = new RestClient(clientConfig);
 Resource resource = restClient.resource("http://xx.xx.xx.xx:9080/myprocess?action=start&params={\"inputName\":\"Test\"}");
 String response  response = resource.contentType(MediaType.APPLICATION_FORM_URLENCODED_TYPE).accept(MediaType.APPLICATION_JSON).post(String.class,"");
Donato Szilagyi
  • 4,279
  • 4
  • 36
  • 53

1 Answers1

0
Here is the code 


secHandler.setUserName(userName);
 secHandler.setPassword(passWord);
 secHandler.setSSLRequired(false);

 ClientConfig clientConfig = new ClientConfig();
 clientConfig.handlers(secHandler);
 RestClient restClient = new RestClient(clientConfig);
 Resource resource = restClient.resource("http://xx.xx.xx.xx:9080/myprocess?action=start
String jsonString ="params={\"inputName\":\"Test\"}")";
 String response  response = resource.contentType(MediaType.APPLICATION_FORM_URLENCODED_TYPE).accept(MediaType.APPLICATION_JSON).post(String.class,jsonString);