cancel
Showing results for 
Search instead for 
Did you mean: 

HandshakeException while sending request from SAP CP (Java)

former_member591190
Discoverer

I'm trying to send GET/POST oData requests from Java-app on SAP CP to the SAP C4C system. From SOAPUI or local machine it works fine, from SAP CP it works too, but not always. Sometimes I got errors like this: 'HandshakeException: Remote host closed connection during handshake' or 'Unable to find valid certification path to requested target'.

 Client restClient = Client.create();
    WebResource webResource = restClient.resource("https://my000000.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/SalesQuoteCollection");
    return webResource.accept("application/json")
            .header("Authorization", "Basic " + authStringEnc)
            .header("x-csrf-token", "fetch")
            .get(ClientResponse.class);

Accepted Solutions (0)

Answers (1)

Answers (1)

Ivan-Mirisola
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Vlad,

The requested resource is https. Therefore, you must provide the correct digital certificate on SCP in order to call it. It is not obvious, but SCP platform doesn't have all certificates for all C4C tenants automatically imported into every single subaccount.

Thus, you need to perform two things:

1) Use the destination service API in your Java code to avoid hard-coding the C4C end-point.

2) While creating a new destination, you can import the digital certificate of your C4C tenant into a secure store jks to be used during SSL handshake.

If you want to avoid doing the above steps you will have to manually code the SSL part on your rest client.

Best regards,
Ivan