When you use the SDK for Java V2.0, requests to Alibaba Cloud services are sent over HTTPS by default. You can use the protocol parameter of the com.aliyun.teaopenapi.models.Config class to select a different communication protocol. Supported values are HTTP and HTTPS. To ensure data security, always use the HTTPS protocol.
com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config();
config.setProtocol("HTTPS");
When you make requests over the HTTPS protocol, the SDK enables SSL/TLS certificate validation by default. If your code environment lacks the required certificates, certificate validation may fail. You can set whether to enable SSL/TLS certificate validation using the ignoreSSL parameter of the com.aliyun.teautil.models.RuntimeOptions class. For example, in a test environment, you can set ignoreSSL to true to ignore certificate validation.
Enable SSL/TLS certificate validation in production environments.
com.aliyun.teautil.models.RuntimeOptions runtimeOptions = new com.aliyun.teautil.models.RuntimeOptions();
// true: Skips certificate verification. false: Verifies the certificate. Default: false.
runtimeOptions.ignoreSSL = true;