I have a JSON string which is coming from Queue. I need to send it as request parameter to create a case in BPM via REST. Rest Service Input- request(String) Therefore I form the below and try to call the rest service
Request- {\"request\":\"{'hits' : [{'id' : '50', 'version' : 1}]}\"}
When i use the uri="https://localhost:9044/rest/bpm/wle/v1/service/RISKM%40CreateCase?action=start¶ms=%7B%22request%22%3A%22%7B+%5C%22hits%5C%22+%3A+%5B+%7B+%5C%22id%5C%22+%3A+%5C%2250%5C%22%2C+%5C%22version%5C%22+%3A+1%7D%5D%7D%22%7D&createTask=false&parts=all";
Above works fine
but when i use the below
uri="https://localhost:9044/rest/bpm/wle/v1/service/RISKM@CreateCase?action=start&createTask=false&parts=all¶ms={\"request\":\"{'hits' : [{'id' : '50', 'version' : 1}]}\"}";
It gives the error:- Error----HTTP Version Not Supported
java.lang.NullPointerException
Response 500
at java.io.Reader.<init>(Reader.java:89)
at java.io.InputStreamReader.<init>(InputStreamReader.java:118)
at com.sita.createCase.Restcall2.readContent(Restcall2.java:193)
at com.sita.createCase.Restcall2.makeRestCall(Restcall2.java:162)
at com.sita.createCase.Restcall2.CallRest(Restcall2.java:94)
at com.sita.createCase.Restcall2.main(Restcall2.java:216)
If i copy the same url in postman it work fine in both the case. Need help on how can i send this request from Java Client. Also how to stringify the json string?
Below is the Java Client Code
HttpsURLConnection connection = null;
try {
URL url = new URL(uri);
connection = (HttpsURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Authorization", authorization);
connection.connect();
}