Set the IODPCertificateChallengeListener to receive certificate requests.
ODPClientConnection ocl = ODPClientConnection.getInstance();
IODPCertificateChallengeListener certListener = new ODPCertificateChallengeListenerImpl();
ocl.setODPCertificateChallengeListener( certListener );
1. Implement the listener
public class ODPCertificateListener implements IODPCertificateChallengeListener
{
// callback method for certificate verification
public boolean isServerTrusted(ODPCertInfo[] certCredentials)
{
Log.i("Do you trust the server for
credentials:"+certCredentials.toString()); //display these credentials for the server
return true; // return true or false depending on userinput from the UI
}
}
2. Register a listener to verify server certificate
ODPCertificateListener odpCertificateListener = new ODPCertificateListener();
ODPUserManager.getInstance().setODPCertificateChallengeListener(odpCertificateListener);
When a client attempts to connect to a host (like a relay server), this connection is authenticated with a basic authentication challenge.To verify if the server certificate is trusted or not, the application registers a listener object with the OData SDK. If the server certificate is trusted, the connection is successful. If the server certificate is not trusted, it is rejected and the connection fails. See "Configuring SAP Mobile Server to use Relay Server" in SAP Control Center for SAP Mobile Platform for information on the configuration of relay server properties.