Forum Stats

  • 3,726,735 Users
  • 2,245,248 Discussions
  • 7,852,382 Comments

Discussions

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Call oracle hcm cloud rest service with space and single quote

PriyaTB
PriyaTB Member Posts: 79 Red Ribbon

Hi,

I need to call hcm rest service https://docs.oracle.com/en/cloud/saas/global-human-resources/r13-update17d/farws/Querying_a_Collection.html  from java. Currently I am using jersey to call the rest service.
I need to call rest service like <hcm-rest-url>/<code class="codeph">resources/latest/emps?q=FirstName like 'Ki%'<br/>

the space gives

Exception in thread "main" java.lang.IllegalArgumentException<br/>  at java.net.URI.create(URI.java:842)<br/>  at com.sun.jersey.api.client.Client.resource(Client.java:434)<br/>..<br/>Caused by: java.net.URISyntaxException: Illegal character in query at index 93: https://<my-hcm-url>/resources/11.12.1.0/emps?q=FirstName like 'Astha'<br/>  at java.net.URI$Parser.fail(URI.java:2809)<br/>  at java.net.URI$Parser.checkChars(URI.java:2982)<br/>  at java.net.URI$Parser.parseHierarchical(URI.java:3072)<br/>  at java.net.URI$Parser.parse(URI.java:3014)<br/>  at java.net.URI.<init>(URI.java:578)<br/>  at java.net.URI.create(URI.java:840)<br/>  ... 3 more

So I tried encoding the url

try { URL = URLEncoder.encode(URL, "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } 

But this gives me

com.sun.jersey.api.client.ClientHandlerException: java.lang.IllegalArgumentException: URI is not absolute<br/>  at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:155)<br/>  at com.sun.jersey.api.client.filter.HTTPBasicAuthFilter.handle(HTTPBasicAuthFilter.java:105)<br/>  at com.sun.jersey.api.client.Client.handle(Client.java:652)<br/>  at com.sun.jersey.api.client.WebResource.handle(WebResource.java:682)<br/>  at com.sun.jersey.api.client.WebResource.get(WebResource.java:193)<br/>......<br/>Caused by: java.lang.IllegalArgumentException: URI is not absolute<br/>  at java.net.URI.toURL(URI.java:1080)<br/>  at com.sun.jersey.client.urlconnection.URLConnectionClientHandler._invoke(URLConnectionClientHandler.java:163)<br/>  at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:153)
This discussion has been closed.