Discussions
Categories
- 17.9K All Categories
- 3.4K Industry Applications
- 3.3K Intelligent Advisor
- 63 Insurance
- 535.7K On-Premises Infrastructure
- 138.1K Analytics Software
- 38.6K Application Development Software
- 5.6K Cloud Platform
- 109.3K Database Software
- 17.5K Enterprise Manager
- 8.8K Hardware
- 71K Infrastructure Software
- 105.2K Integration
- 41.5K Security Software
Problem in connect to a REST service

Hi,
I'm new working with JCS SX.
I need to connect to REST service of our Saas (CRM).
The basic thing that I'm trying is using the following code:
import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.config.ClientConfig;
import com.sun.jersey.api.client.config.DefaultClientConfig;
import com.sun.jersey.api.client.filter.ClientFilter;
import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter;
import com.sun.jersey.api.client.filter.LoggingFilter;
import com.sun.jersey.client.urlconnection.HTTPSProperties;
import javax.net.ssl.SSLContext;
public String doRestAPI_Click() { | |
try { | |
SSLContext sslContext = SSLContext.getDefault(); | |
ClientConfig def = new DefaultClientConfig(); | |
String response = ""; | |
System.out.println("start - RESP API"); | |
def.getProperties().put(HTTPSProperties.PROPERTY_HTTPS_PROPERTIES,new HTTPSProperties(null, sslContext)); | |
Client c = Client.create(def); | |
c.addFilter(new HTTPBasicAuthFilter("USER", "Passwd")); | |
WebResource webResource = c.resource("https://our_server/fscmRestApi/resources/11.13.0.0/items"); | |
System.out.println("before end - RESP API"); | |
response = webResource.get(String.class); | |
System.out.println("end - RESP API"); | |
} | |
catch(Exception e){ | |
System.out.println(e.getMessage()); | |
} | |
return null; | |
} |
but I'm receiving this error:
javax.net.ssl.SSLKeyException: FATAL Alert:BAD_CERTIFICATE - A corrupt or unuseable certificate was received.
<oracle.adf.view> <CellGatherCallback> <_ensureValidInlineStyle> <PANEL_GRID_LAYOUT_INVALID_CELL_STYLE>
<oracle.adf.view> <CellGatherCallback> <_ensureValidInlineStyle> <PANEL_GRID_LAYOUT_INVALID_CELL_STYLE>
Can any one tell me what is missing or what I'm doing wrong.
I have check several examples, and the code seems to be similar.
Thanks,
Jose Pedro
Answers
-
I found the problem.
I had to change some configuration in the jdeveloper integrated weblogic to be able to invoke the REST service
-
hi , i have the same problem , could u please tell me the solution and the steps to consume rest api in your application ?