In the article before I explained how to access 2 projects on the same CMS server. If you work with several installations, maybe per stage (production, test, and so on), you need to access different servers at the same time.
jRQL offers in general 2 possibilities to connect: via existing session data (logon GUID, session key) and by user name and password. Both cases can be extended to connect different CMS servers.
In both cases you need to adjust the client object creation with the URL of the bridge ASP who uses jRQL for communication with the CMS.
See first re-using existing session data in the following lines of code.
CmsClient clientOld = new CmsClient(logonGuidOld, new URL(“http://reddot.hlcl.com/cms/hlclRemoteRql.asp”));
Project projectOld = clientOld.getProject(sessionKeyOld, projectGuidOld);
CmsClient client = new CmsClient(logonGuid, new URL(“http://kswfrd02/cms/hlclRemoteRql.asp”));
Project project = client.getProject(sessionKey, projectGuid);
// by old page id
Page sourcePg = projectOld.getPageById(“127290”);
// by new page id
Page targetPg = project.getPageById(“2”);
The important point here is the creation of client objects clientOld and client. You see, that they access a CMS installation on reddot.hlcl.com and kswfrd02. Don’t forget to copy the hlclRemoteRql.asp file into \CMS\ASP directory.
If you need to access several projects on different CMS servers by user name and password, use the style below. The only difference is the creation of the client1 and client2 objects, where the helper class PasswordAuthentication is used to hold user name and password. The rest is similar.
CmsClient client1 = new CmsClient(new PasswordAuthentication("lejafr", "pw"), new URL("http://reddot.hlcl.com/cms/hlclRemoteRql.asp"));
Project project1 = client1.getProjectByName("hip.hlcl.com");
CmsClient client2 = new CmsClient(new PasswordAuthentication(“lejafradm”, “pw”), new URL(“http://kswfrd02/cms/hlclRemoteRql.asp”));
Project project2 = client2.getProjectByName(“hlag_wm2008”);
Page source1Pg = project1.getPageById(“127290”);
// by new page id
Page target2Pg = project2.getPageById(“2”);
In this example it is important to logoff both users from the CMS with the disconnect() methods. In practice I recommend to use it within a finally block.
You find the source code within the respective sample class in the jRQL download.