Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/346.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java ApacheWink-在URL中发送JSON字符串_Java_Json_Rest_Apache Wink - Fatal编程技术网

Java ApacheWink-在URL中发送JSON字符串

Java ApacheWink-在URL中发送JSON字符串,java,json,rest,apache-wink,Java,Json,Rest,Apache Wink,URL为:{\“inputName\”:\“Test\”} 在上面的URL中,我的JSON字符串是{\“inputName\”:\“omsai\”} 我用以下方式调用ApacheWinkREST(POST)调用,但它不起作用。我得到了java.net.URISyntaxException secHandler.setUserName(userName); secHandler.setPassword(passWord); secHandler.setSSLRequired(false);

URL为:{\“inputName\”:\“Test\”}

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

我用以下方式调用ApacheWinkREST(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,"");

它成功了,这是代码
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);