Moving a connection from one PingFederate server to another requires care, as the target server must contain the global configuration items (data stores, keypairs, and adapter instances) that the connection references. Changing the references in the XML file—either manually or programmatically—may be necessary to adjust the connection to the target PingFederate environment.

Once required changes are made to the XML file, developers can use the Connection Management Service to import the connection into a different instance of PingFederate.

Tip:

Alternatively, you can import XML connection files via the PingFederate administrative console (see Accessing SP connections or Accessing IdP connections). You can also import the connections into PingFederate manually by copying them into the <pf_install>/pingfederate/server/default/ data/connection-deployer directory.

PingFederate scans this directory periodically and imports connections automatically.

CAUTION:

Manually importing a connection always overwrites an existing connection with the same ID (the web service provides a switch to disallow this behavior, if desired—see below).

The web service exposes the following method for importing connections:

public void saveConnection( String xml, boolean allowUpdate) throws IOException

The xml parameter is the complete representation of the connection retrieved by your application from an exported connection file (and optionally modified).

If allowUpdate is false, the web service can be used only to add a new connection. An error occurs if a connection already exists with the same connection ID and federation protocol in the XML. If allowUpdate is true and the connection already exists, it will be overwritten.

Sample code

The following example uses the Apache AXIS libraries to invoke this web service to create a new connection:

Service service = new Service();
    Call call = (Call) service.createCall();
    call.setUsername("username");
    call.setPassword("password");
    String addr = "https://localhost:9999/pf-mgmt-ws/ws/ConnectionMigrationMgr";
    call.setTargetEndpointAddress(addr);
    call.setOperationName("saveConnection");
    String xml = "<EntityDescriptor entityID=\"some_entity_id\"
		... 	
		</EntityDescriptor>";
    boolean allowUpdate = false;
    call.invoke(new Object[]{xml, allowUpdate});