Scripting and Programming Guides › Developer's Guide for Java › Java API Overview › Java API Flow › Establish a Connection to the Policy Server › Establish a Default Connection
Establish a Default Connection
If you have not already established a connection to the Policy Server, you can request an automatic connection. If SiteMinder establishes a connection for you automatically, it creates a default Java Agent API object and handle. However, if a valid user-defined handle already exists, SiteMinder does not create a default object and handle. A user-defined handle takes precedence over a default handle.
To establish a default connection to the Policy Server automatically
- Use the following constructor to create an API connection object:
SmApiConnection (boolean bDefaultAgentConnection
boolean disableLoadBalancing)
- In the constructor, set bDefaultAgentConnection to true—for example:
SmApiConnection m_defaultConnection =
new SmApiConnection(true,false);
- If bDefaultAgentConnection is false, you must explicitly establish the connection in your client code.
An automatic connection has the following requirements:
- Your Web Agent be installed on the same machine where you are running the Agent API.
- The property DefaultAgentName in the Web Agent configuration object contains an agent name. You define the Web Agent configuration object in the Policy Server.
- With Apache Web Agents, the path to the Agent configuration file is in the CLASSPATH. With Microsoft IIS Web Agents, this configuration information is in the Registry, so a CLASSPATH reference is not necessary.