I am using salesforce soap API i has activated tls 1.1 in SF-->Critical updates
i am getting this error UNSUPPORTED_CLIENT: TLS 1.0 has been disabled in this organization. Please use TLS 1.1 or higher when connecting to Salesforce using https.
I
UNSUPPORTED_CLIENT: TLS 1.0 has been disabled in this organization. Please use TLS 1.1 or higher when connecting to Salesforce using https.
I am using java 7 update 79. My sample code for testing TLS.
public class TestSaleforce {
public static void main(String[] args) throws UnexpectedErrorFault, ApiFault {
// TODO Auto-generated method stub
String username = "abc";
String password = "abc";
String authEndPoint = "https://tls1test.salesforce.com/services/Soap/u/35.0/";
try {
/* ConnectorConfig config = new ConnectorConfig();
config.setUsername(username);
config.setPassword(password);
*/
System.out.println("AuthEndPoint: " + authEndPoint);
//config.setAuthEndpoint(authEndPoint);
SoapBindingStub binding = null;
binding = (SoapBindingStub) new SforceServiceLocator().getSoap();
binding._setProperty(SoapBindingStub.ENDPOINT_ADDRESS_PROPERTY, authEndPoint);
LoginResult rs = null;
rs = binding.login(username, password);
// Print user and session info
GetUserInfoResult userInfo = rs.getUserInfo();
System.out.println("UserID: " + userInfo.getUserId());
System.out.println("User Full Name: " + userInfo.getUserFullName());
System.out.println("User Email: " + userInfo.getUserEmail());
System.out.println(rs.getServerUrl() + rs.getSessionId());
// System.out.println("SessionID: " + config.getSessionId());
// System.out.println("Auth End Point: " + config.getAuthEndpoint());
// System.out.println("Service End Point: " + config.getServiceEndpoint());
binding._setProperty(SoapBindingStub.ENDPOINT_ADDRESS_PROPERTY, rs.getServerUrl());
SessionHeader sh = new SessionHeader();
sh.setSessionId(rs.getSessionId());
binding.setHeader(new SforceServiceLocator().getServiceName().getNamespaceURI(), "SessionHeader", sh);
QueryOptions qo = new QueryOptions();
System.out.println(new Date()+" + " SETTING Query Batch Size");
qo.setBatchSize(new Integer(2000));
binding.setHeader(new SforceServiceLocator().getServiceName().getNamespaceURI(), "QueryOptions", qo);
QueryResult qResult = null;
String soqlQuery = "select RecordType.Name,Email,HasOptedOutOfEmail,Owner.Name,Owner.Email,BMS__leadOpp__r.Name,Id from lead WHERE (RecordType.Name='') AND IsConverted=FALSE";
qResult = binding.query(soqlQuery);
boolean done = false;
if (qResult.getSize() > 0) {
System.out.println("Logged-in user can see a total of " + qResult.getSize() + " contact records.");
}
} catch (RemoteException | ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
And other thing i wanted to add is it, It is working fine with java 8 .So So please help me out to enable TLS 1.1 on java 7.