Forum Stats

  • 3,780,849 Users
  • 2,254,447 Discussions
  • 7,879,484 Comments

Discussions

Java Client Method to Call - Oracle SAAS - REST WebService

Hi Team,

i have an issue while calling : Oracle SAAS - HRMS Rest WebService.

Following is the code i used :

package callrestfulws;import com.sun.jersey.api.client.Client;import com.sun.jersey.api.client.ClientResponse;import com.sun.jersey.api.client.WebResource;import com.sun.jersey.core.util.MultivaluedMapImpl; import javax.ws.rs.core.MultivaluedMap;public class CallRestFulWS{  public static void main(String[] args)  {    try    {      Client client = Client.create();      WebResource webResource = client.resource("https://rws2-fap0247-hcm.oracledemos.com/hcmCoreApi/resources/11.1.11/emps//?q=PersonNumber=715"); // Web Service URL                MultivaluedMap queryParams = new MultivaluedMapImpl();      ClientResponse response = webResource.queryParams(queryParams).get(ClientResponse.class); // for get method      System.out.println("response.getStatus()response.getStatus()= " + response.getStatus());      if (response.getStatus() != 200)      {        throw new RuntimeException("Failed : HTTP error code : " + response.getStatus());      }      String output = response.getEntity(String.class);      System.out.println("Output from Web Servicve: " + output);          }    catch (Exception e)    {      e.printStackTrace();    }  }}

Error While Invoking It

c:\jdev11117\jdk160_24\bin\javaw.exe -client -classpath C:\jdev\mywork\CallRestFulWSProgramatically\.adf;C:\jdev\mywork\CallRestFulWSProgramatically\CallRestFulWS\classes;C:\Sridhar\MyContributions\RestfulApplication\RestfulApplication\libs\jersey-core-1.18.jar;C:\Sridhar\MyContributions\RestfulApplication\RestfulApplication\libs\asm-3.1.jar;C:\Sridhar\MyContributions\RestfulApplication\RestfulApplication\libs\jersey-server-1.18.jar;C:\Sridhar\MyContributions\RestfulApplication\RestfulApplication\libs\jersey-servlet-1.18.jar;C:\Sridhar\MyContributions\CallRestfullWSProgrammatically\CallRestfullWSProgrammatically\libs\jersey-core-1.18.jar;C:\Sridhar\MyContributions\CallRestfullWSProgrammatically\CallRestfullWSProgrammatically\libs\jersey-client-1.18.jar -Djavax.net.ssl.trustStore=C:\jdev11117\wlserver_10.3\server\lib\DemoTrustNew3.jks -Dhttp.proxyHost=localhost -Dhttp.proxyPort=8099 -Dhttp.nonProxyHosts=~localhost -Dhttps.proxyHost=localhost -Dhttps.proxyPort=8099 -Dhttps.nonProxyHosts=~localhost callrestfulws.CallRestFulWScom.sun.jersey.api.client.ClientHandlerException: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure  at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:155)  at com.sun.jersey.api.client.Client.handle(Client.java:652)  at com.sun.jersey.api.client.WebResource.handle(WebResource.java:682)  at com.sun.jersey.api.client.WebResource.get(WebResource.java:193)  at callrestfulws.CallRestFulWS.main(CallRestFulWS.java:22)Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure  at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174)  at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:136)  at com.sun.net.ssl.internal.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1720)  at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:954)  at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1138)  at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1165)  at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1149)  at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:434)  at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:166)  at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1172)  at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:379)  at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:318)  at com.sun.jersey.client.urlconnection.URLConnectionClientHandler._invoke(URLConnectionClientHandler.java:253)  at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:153)  ... 4 morePicked up JAVA_TOOL_OPTIONS: -Djava.vendor="Sun Microsystems Inc."Process exited with exit code 0.

Please let me know what is issue ?

Reg

Sridhar

This discussion has been closed.