1

I want to send something.crt with HttpURLConnection.

It always says something like:

javax.net.ssl.SSLException: Received fatal alert: unexpected_message

String requestURL = "https://some.thing.com:5874/SomeService/OperationsEndpoint1";

HttpsURLConnection connection = (HttpsURLConnection) new

URL(requestURL).openConnection();

connection.setRequestMethod("POST");

String httpCode = connection.getResponseCode();

String responseMessage = connection.getResponseMessage();

Pritom
  • 1,294
  • 8
  • 19
  • 37

1 Answers1

4

You would use the javax.net.ssl.HttpsURLConnection class, not java.net.HttpURLConnection.

frogatto
  • 28,539
  • 11
  • 83
  • 129
Harsh Poddar
  • 2,394
  • 18
  • 17