I recently come across a situation where I faced an issue while calling a web service. It took me several hours to get the exact reason. Sharing it if it can help someone & save time.
In the requirement, there was a .net web service & I am calling it from the salesforce code. The code is having normal HTTP call steps as below-
HttpRequest req = new HttpRequest(); req.setMethod('POST'); req.setHeader('Content-Type','text/xml; charset=utf-8'); req.setEndpoint("YOUR_HTTPS_ENDPOINT"); req.setBody("SET_BODY"); req.setHeader('SOAPAction','http://www.XXX.com/schemas/FunctionABC'); res = http.send(req);here when I was sending this http request, getting below issue-
System.HttpRequest retrying request in response to handshake failure: Server chose TLSv1, but that protocol version is not enabled or not supported by the client.
System.CalloutException: Server chose TLSv1, but that protocol version is not enabled or not supported by the client.
Tried couple of ways to solve it but nothing worked. Finally, I start looking into the salesforce documentation & I found below url –
as per the salesforce documentation, salesforce disabled TLS 1.0, because of that I was getting that exception. Client org was the latest one & due to that it is already disabled in that org.
I tried the same code in one of my old org & that works. This code can work only if you can see below line in setupà critical update section –
Please notice that, the code works well here because I did not activated above update yet on my old dev org.
I am not sure what needs to be done at service end to fix the issue but this is just an idea if someone facing the issue. At least he can get what the reason behind the issue.