Hi all, I'm posting this for a customer - any ideas here?
I'm running into an SSL handshake error when I try to connect to the API server at https://api.mypurecloud.com from my Java program. The strange thing is, I have no issues calling the authentication endpoint on https://login.mypurecloud.com from Java.
I don't have any errors hitting that endpoint using Postman or chrome, so I'm pretty sure its something in Java causing the issue. It appears that both servers have the same certificate and at least in a browser seem to use the same cipher algorithm, so I'm not sure why my program can connect to one but not the other.
The error I get is:
javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
Which I think means the server is rejecting the connection for some reason. Do you or anyone else there have experience calling your API from a Java application and if so, was there anything you had to do to get past this? Are you able to see any additional info on the server side that would help troubleshoot why this is failing?
What Java library are you using? The Java SDK uses Jersey and is able to make requests.
I am using the Apache HttpComponents HttpClient library and Java 1.8.
It's probably a SNI issue with the library you're using. I've seen some people run into problems with certain Java libraries that do not support SNI. There's a Stack Overflow post discussing SNI with this library and how to troubleshoot it. There's also a known bug in Java 1.8 that causes an issue with SNI.
Thanks for the info regarding SNI. I did a simple test using your java SDK and that seems to work for me, so I'll just head down that path. Thanks for the help!
1 Like
I'm facing the same problem currently. What did you do to resolve this?
My solution was to use the Java SDK that used Jersey instead of the apache HTTP Client, which was working OK, but I just tried updating to the new version 0.18.0.59 that was just announced and since it now uses the apache HTTP Client, I am now back to where I started.
I tried to pull that new version via gradle, but was unable to do so using:
compile group: 'com.mypurecloud', name: 'platform-client', version: '0.18.0.59'
I'm using java version "1.8.0_102" by the way
Nevermind, I had some gradle caching issues going on. I was able to get the new 59 update and now my problem is resolved. Looks like you have to have a Java SDK that uses apache http client as well as purecloud sdk that uses apache http client. I'm able to hit purecloud API using their SDK in my springboot gradle project.
It looks like my issue was caused by other dependencies in my project that were pulling in older versions of httpcore and httpclient. I added explicit dependencies (shown below) and it fixed the issue for me.
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.2</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.5</version>
</dependency>
Looks like you're all set now, but let me know if you have any further issues with the SDK. I am able to use the Java SDK by simply adding it as a maven dependency using IntelliJ. I'll be posting some examples/tutorials sometime soon, but I can share my test app now if it would help.
Also, I can't claim Java as my primary language, so if there's anything you're seeing that looks wrong, please make a post about it to explain what's wrong and how it could be improved. My goal is to make the SDKs as approachable as possible and I very much welcome feedback from the community!
1 Like