Every ServerContext instance has an AgentContext instance.
When you instantiate ServerContext, you can pass an instance of AgentContext to the constructor. If you do not specify an AgentContext, the constructor automatically creates an AgentContext with the same host, user name, and password values as those defined in the ServerContext.
It also assigns 9999 as the port number for
AgentContext, for these reasons:
- SAP Mobile Server and
SAP Control Center are installed on the
same host, and they share the same security provider.
- By default, SAP Control Center listens on
port 9999. The administration API connects to
SAP Control Center using this port.
This sample creates a
ServerContext that uses
values of supAdmin and supPwd for the user name and password, and uses
secure port (2001) by specifying "true" in the last
parameter:
ServerContext serverContext = new ServerContext();
serverContext = new ServerContext("<host name>", 2001, "supAdmin", "supPassword", true);
The usage of secure port does not require server certificate
installation on the client-side. It is assumed that server is configured
with a valid and secure certificate for transport level security, and client
authentication is done via the security provider assigned to the "admin"
security configuration.