Cookie Consent by TermsFeed

Get Groovy With UCM (Stellent)

June 11, 2009

Yet another way to work with UCM? You bet! But this one is super Groovy (sorry, I had to do that). Check out how to setup Groovy and the Remote Intradoc Client to integrate with the Oracle Fusion Enterprise Content Management platform. You know you want to!

I really like the Remote Intradoc Client (RIDC). RIDC allows me to control UCM (Stellent) from a Java based application (Console, JSP, Servlet, etc.). What was that? Sounds similar to Content Integration Suite (CIS) you say? Yes, so far it does. RIDC is a thinner, light weight framework for those already familiar with UCM services. RIDC has very few of those "helper methods" that would guide you through the intelli-sense embedded in your IDE. However, for those familiar with services or willing to research them RIDC will offer tremendous capacity with little effort.

You can get RIDC as part of the CIS download from here. Within the CIS download is a folder containing the jar files and documentation needed to get up to speed on RIDC. This is not a deep dive on RIDC itself, but more of a sampling of how I use it to integrate/control UCM. Bex Huff has a similar article using Jython with RIDC. There is always more than one way to skin a cat.

I make use of RIDC via Groovy. Side Note: Groovy is built in with ADF 11g and Oracle uptake on Groovy will go even deeper in the future.

Important Groovy Links Download – As of this writing the latest version of Groovy was 1.6.3. Documentation – (Tons of examples!) Getting Started – Discusses configuration of the JDK and variables like JAVA_HOME Pure Groovy Examples

Sample #1 – Hello World

println "Hello, World!"

Sample #2 – JSON Like Syntax Possibilities

scores = [ "Brett":100, "Pete":"Did not finish" ] println scores["Pete"] println scores.Pete

Groovy UCM Sample How about we start with a very simple example? We will use Groovy to Ping the Content Server. Start by opening the Groovy Console application. From there I need to use the "Script" menu to add a reference to the RIDC JAR file. At this point the environment is pretty well ready to go and we can start writing code in the console to be executed. To execute the code you can use CTRL-R, and to clear the output window you can use CTRL-W.

Using RIDC is easiest when we are familiar with the services calls, the parameters to send the calls, and what to expect in the response from the calls. If you set your profile to Top Menus so you can see the URL you will be able to look at the variables passed around to service calls as you surf through content server. You could also use a tool like Fiddler or another HTTP proxy/sniffer to spy on the parameters being swapped with content server by your browser.

Use the "Script" menu to add JARs.

Add the RIDC JAR specifically.

As an example, when I execute this url:

http://localhost/idc/idcplg?IdcService=PING_SERVER&IsJava=1

I get back a response like this one below, which I can then use RIDC/Groovy to access the response data.

@Properties LocalData dUser=sysadmin blFieldTypes=StatusMessage message refreshSubMonikers= StatusMessage=You are logged in as 'sysadmin'. blDateFormat=M/d/yy {h:mm[:ss] {aa}[zzz]}!mAM,PM!tAmerica/Chicago XmlEncodingMode=Full changedSubjects= refreshSubjects= refreshMonikers= changedMonikers= IdcService=PING_SERVER IsJava=1 @end

Armed with this request/response knowledge, we can create a Groovy script using RIDC like this:

// Import needed classes from Remote Intradoc Client Jar import oracle.stellent.ridc.IdcClientManager import oracle.stellent.ridc.IdcContext

// Create the client for request/response client = (new IdcClientManager()).createClient("idc://localhost:4444")

// Create a user/security context, don't need a as we're connecting // directly to ucm and we're a trusted ip userContext = new IdcContext("sysadmin")

// Setup the request req = client.createBinder() req.putLocal("IdcService", "PING_SERVER")

// Get the response resp = client.sendRequest(userContext, req).getResponseAsBinder()

// Use the response, should say "Response: you are logged in as 'sysadmin'" println "Response: ${resp.getLocal("StatusMessage")}"

// Wrap it up! println "Done"

Here's what this looks like run in Groovy Console:

You may need to add your ip address to the IP Address Filter of content server for this script to run (as it is written). You can also use a user name and password with RIDC. This is covered in the documentation.

Download the Sample PingServer.groovy Script.

© 2020 Jason Stortz (version 20200114-085855)