0

网址是:http://xx.xx.xx.xx:9080/myprocess?action=start¶ms= {\"inputName\":\"Test\"}

在上面的 URL 中,我的 JSON 字符串是 {\"inputName\":\"omsai\"}

我正在通过以下方式调用 Apache Wink Rest(POST) 调用,但它不起作用。我得到 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,"");
4

1 回答 1

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);
于 2013-01-11T12:37:09.533 回答