DS API and RQL via AJAX – A Test Drive

Recently in the community I’ve been advocating and drumming up support for DS REST API and Jian, Kim, and Manuel have been discussing MS Plugins using AJAX to call RQL. I recently got an opportunity to give them a test drive to see how they will work for rapid prototyping a solution for a Proof of Concept (POC). I was impressed.

The scenario (as originally understood):

To create a set of JSP pages that provide access to WSM

1)DS to display different contents based on date range, resolution, and later an audience category for personalization.

2) Remote access to Asset Manager contents, and on selection return relative paths for where published files would reside.


After installing (used the quick start guide for backup) and testing base functionality. I jumped back to Management Server to create contents with metadata to drive the searches. Some assigned by categories and keywords, some by standard fields, and some embedded in the content class templates. After publishing I created a redundant database structure.

Screen capture of attributes and constraint

I created a new handler by copying the existing Target DynaMent handler. I removed authentication for the handler, as this is a POC it just make things simpler. I developed a query to the  specified my parameters.


I added a couple DynaMents to write constraints for me based on values of ‘constrainttime’ and ‘hres’. And I had a single content returned per date/resolution. I finished it up by adding a simple HTML XSLT so the content of this one item is accessible as if it were called directly. The rest was some JSP to scrape characters from a URL into a StringBuffer. Much more sophisticated option is possible but it is a POC.


var loginguid=””;
var sessionguid=””;$(document).ready(function() {// hide search result area
if($.cookie(“assetlogin”) == null || $.cookie(“assetsession”) == null || $.cookie(“assetlogin”) == “” || $.cookie(“assetsession”) == “”)
if(“<%= session(“sessionkey”) %>” ==”” || “<%= session(“loginguid”) %>”==””){
//alert(“asp vars”);
loginguid=”<%= session(“loginguid”) %>”;
sessionguid=”<%= session(“sessionkey”) %>”;

function DisplayAssets(FolderGuid)
if(FolderGuid == “”)
$(“#searchresult .content”).append(“<div class=\”error\”>Error</div>”);

$(“#searchresult .content”).empty();

//load simple page info
var strRQLXML = padRQLXML(“<MEDIA><FOLDER guid=\””+FolderGuid+ “\” subdirguid=\””+FolderGuid+”\”><FILES action=\”list\” view=\”list\” sectioncount=\”-1\” maxfilesize=\”0\” attributeguid=\”\” searchtext=\”*\” pattern=\”\” startcount=\”1\” orderby=\”name\”/></FOLDER></MEDIA>”);
$.post(“/CMS/PlugIns/RemoteAssetManager/rqlaction.asp”, { rqlxml: strRQLXML },
// add stuff to search results
if($(data).find(“FILE”).attr(“name”) != null)
//add on click alert http://host/saq/images/imagename
$(“#searchresult .content”).append(“<div style=\”border: 2px solid grey; padding 15px;\”><a onclick=\”alert(‘URL for Integration Externally: http://host/url/images/”+$(this).attr(“name”)+”‘)\” href=\”#img=” + $(this).attr(“name”) + “\”><br/><img style=\”border:3px solid black;\” src=\”http://win-kk55dom76sa/cms/”+$(this).attr(“thumbnailpath”)+”\” /><br/>” + $(this).attr(“name”) + “</a><br/> </div>”);
$(“#searchresult .content”).append(“<div class=\”error\”>Folder with guid ” + FolderGuid + ” not found.</div>”);
}, “xml”);

function login(){
// login
var strLoginRQLXML = “<IODATA> <ADMINISTRATION action=\”login\” name=\”admin\” password=\”dontdothis\”/></IODATA>”;
$.post(“/CMS/PlugIns/RemoteAssetManager/rqlaction.asp”, { rqlxml: strLoginRQLXML },
//handle the login request
$.cookie(“assetlogin”, loginguid);
//alert(“loginguid: “+loginguid);
//”<IODATA loginguid=\”<%= session(“loginguid”) %>\” sessionkey=\”<%= session(“sessionkey”) %>\”>” + innerRQLXML + “</IODATA>”;
var strProjectRQLXML = padRQLXMLNoSession(“<ADMINISTRATION action=\”validate\”><PROJECT guid=\”0B7FE095D7814EE48B95B2E2A41A0BA0\” /></ADMINISTRATION>”);
$.post(“/CMS/PlugIns/RemoteAssetManager/rqlaction.asp”, { rqlxml: strProjectRQLXML },
//handle the login request
$.cookie(“assetsession”, sessionguid);
}, “xml”);
return “”;
}, “xml”);
return “”;

function padRQLXML(innerRQLXML)
return “<IODATA loginguid=\””+loginguid+”\” sessionkey=\””+sessionguid+”\”>” + innerRQLXML + “</IODATA>”;
function padRQLXMLNoSession(innerRQLXML)
return “<IODATA loginguid=\””+loginguid+”\”>” + innerRQLXML + “</IODATA>”;

This made a quick and easy UI to include via a similar JSP to the ones used for Delivery Server. This could be expanded on by


Both satisfied the technical requirements as they were understood. Some on the fly reconfiguration during a break was able to more accurately meet the customers requirements.

Time Frame:

Total time <16 hrs

This includes download, install, configuration of REST project. A good amount of this time was spent coding the JSP to include the results of my REST services. I will be honest I’m really a novice with limited hands on experience. Only some rusty revision of existing RQL scripting as background and an existing AJAX plugin as guide.


Published by


I'm Tim Davis. My primary professional interests are web, web content, and mobile. Currently I lead services team centered around OpenText Web Site Management (FKA: RedDot) for the Americas.

3 thoughts on “DS API and RQL via AJAX – A Test Drive”

  1. Hey Tim,

    Interesting article.

    I thought I would mention an alternate solution we've been starting to use at Enthink on projects. That is to do RQL purely via JS. All these solutions require the client to setup the rql.asp file which essentially only creates a call to the RQL interface and takes commands from JS. Instead of doing this we've created a small SOAP client in JS which just creates SOAP envelopes and calls the RQL Web Service in MS directly. This is a small difference but what it allows you to do is extend or create multi-step functionality in CMS to allow authors to manage content more easily.

    A JS SOAP client can be downloaded here http://www.codeproject.com/KB/ajax/JavaScriptSOAP… and depending on the server you can directly hit the RQL Service with an RQL call. An example of how we are using this can be seen below.

    Enthink.Settings.RQLServiceURL = "/cms/Navigation/Services/RqlService.asmx";

    // RQL function to rename a page filename.
    Enthink.RQL.Page.FileNameWrite = function( pageGuid, fileName )
    var sp = new SOAPClientParameters();
    sp.add('command', '<IODATA loginguid="<%inf_LoginGUID%>" sessionkey="<%inf_SessionKey%>"><PAGE action="save" guid="' + pageGuid + '" name="' + fileName + '"/></IODATA>');
    SOAPClient.invoke(Enthink.Settings.RQLServiceURL, 'ExecuteString', pl, true, Enthink.RQL._callback);

    Just another perspective on how to do AJAX RQL I thought was worth mentioning. We're working on creating a RQL JS library which would allow us to create better interfaces in SmartEdit without the need to install plugins for client projects, but still have the ability to re-use some code for plugins when needed.

    1. A good point. The only consideration I'd suggest is looking at performance of the SOAP interface vs Direct calls. For lower usage interface either is a good solution. Glad you are on the same path with development techniques. The one ASP file can serve for N endpoints of any language. Thanks for the feedback.

    2. Hi Arek,

      Thanks for the feedback. That definitely provides another option in RQL plugin development.

      My experience with Webservice VS. ASP Connector so far:

      I used ILSpy and found:

      RQL Communication order

      User -> RQL Web Service (Remoting) -> RQL Windows Service -> COM .NET Interop -> COM (VB unmanaged code).

      Also, RQL Web Service uses a semi singleton pattern wrapped mutex for threadsafe execution. My concern with the implementation is that the semi singleton pattern might introduce memory leak after heavy use. Mutex is needed for threadsafe execution, but Management Server also uses this web service, so now the plugin is competing with the system for access, everything slows down.

      As Tim mentioned, ASP connector should be faster since it is 2 layers lower than the Web Service. After some general everyday testing and usage, it seems that the ASP connector is much faster during bulk RQL commands, uses less system resources, and has minimal effect on MS performance.

Leave a Reply