Wednesday, December 8, 2010

Oracle UCM 11g Remote Intradoc Client (RIDC) Integration with Oracle ADF 11g

Few days ago I was describing Oracle Universal Content Management (UCM) 11g connection setup from JDeveloper 11g for Oracle WebCenter 11g ADF task flows - Oracle Universal Content Management 11g and Oracle ADF/WebCenter 11g Integration. Its great we have out of the box WebCenter ADF task flows for document management in UCM. However, for complete business scenario implementations usually its not enough and we need to manage Content Repository programmatically. This can be achieved through Remote Intradoc Client (RIDC) API. Its quite hard to find any practical information about this API, but I managed to get code for UCM folder creation/removal and folder information. Will share it today with you, through sample application -

To compile this sample application, you will need to install RIDC library as extension for JDeveloper 11g. Please read instructions available here.

This application allows to add new employee, same time when new employee record is stored in database, it automatically creates new folder in UCM. Folder name is the same as employee ID, this allows to show documents related to selected employee. Adding new employee into the system:

Newly added employee is assigned with ID #232, folder with the same name is created in UCM (achieved programmatically using RIDC API) - WebCenter Document Management ADF task flow renders this folder:

UCM folder is changed dynamically, based on employee table row selection, because startFolderPath parameter points to managed bean method - where folder path is constructed based on current employee row selection:

We can upload new documents using out of the WebCenter functionality:

If someone is trying to remove employee record, we can check first if any documents exist for this employee. If there are documents available in Content Repository - employee removal can be prevented (achieved programmatically, using RIDC API):

Delete associated documents first:

Employee record is removed successfully:

Below I'm listing RIDC API methods from sample application. Connection with UCM is established through socket type, without specifying Content Repository password, Identity Propagation is done automatically through ADF Security Context.

1) Create new UCM folder

DataBinder dataBinder = idcClient.createBinder();
dataBinder.putLocal("IdcService", "COLLECTION_ADD");
dataBinder.putLocal("hasParentCollectionID", "true");
dataBinder.putLocal("dCollectionName", folderName);
dataBinder.putLocal("dParentCollectionID", this.getFolderIdFromPath(idcClient, userContext, PATH));
dataBinder.putLocal("dCollectionOwner", "sysadmin");
ServiceResponse response = idcClient.sendRequest(userContext, dataBinder);
DataBinder serverBinder = response.getResponseAsBinder();

There is no need to close RIDC connection after request, it is closed automatically when response.getResponseAsBinder() method is invoked. For new folder we must specify parent folder ID, it is internal UCM identificator, it can be retrieved from folder path:

2) UCM folder ID Info

DataBinder dataBinder = idcClient.createBinder();
dataBinder.putLocal("IdcService", "COLLECTION_INFO");
dataBinder.putLocal("hasCollectionPath", "true");
dataBinder.putLocal("dCollectionPath", path);
ServiceResponse response = idcClient.sendRequest(userContext, dataBinder);
DataBinder serverBinder = response.getResponseAsBinder();
DataResultSet resultSet = serverBinder.getResultSet("PATH");
DataObject dataObject = resultSet.getRows().get(resultSet.getRows().size() - 1);
folderId = dataObject.get("dCollectionID");

3) Delete UCM folder

DataBinder dataBinder = idcClient.createBinder();
dataBinder.putLocal("IdcService", "COLLECTION_DELETE");
dataBinder.putLocal("hasCollectionID", "true");
dataBinder.putLocal("dCollectionID", this.getFolderIdFromPath(idcClient, userContext, path));
dataBinder.putLocal("force", "true");
dataBinder.putLocal("deleteImmediate", "true");
ServiceResponse response = idcClient.sendRequest(userContext, dataBinder);

4) Check if folder contains Files or internal Folders

DataBinder dataBinder = idcClient.createBinder();
dataBinder.putLocal("IdcService", "COLLECTION_GET_COLLECTIONS");
dataBinder.putLocal("hasCollectionID", "true");
dataBinder.putLocal("dCollectionID", this.getFolderIdFromPath(idcClient, userContext, path));
ServiceResponse response = idcClient.sendRequest(userContext, dataBinder);
DataBinder serverBinder = response.getResponseAsBinder();

DataResultSet resultSet = serverBinder.getResultSet("COLLECTIONS");
docCount += resultSet.getRows().size();

dataBinder = idcClient.createBinder();
dataBinder.putLocal("IdcService", "COLLECTION_GET_CONTENTS");
dataBinder.putLocal("hasCollectionPath", "true");
dataBinder.putLocal("dCollectionPath", path);
response = idcClient.sendRequest(userContext, dataBinder);
serverBinder = response.getResponseAsBinder();

resultSet = serverBinder.getResultSet("CONTENTS");
docCount += resultSet.getRows().size();

When I was working with UCM RIDC API, sometimes its very tough to get any info about API method return values. But there is a small trick, you can iterate through response result set names and get names for all return values:

Iterator iter = serverBinder.getResultSetNames().iterator();
while (iter.hasNext()) {


Amr Ismail Gawish said...

I've been using RIDC for a while, its amazing how can you accomplish using this APIs
Like for instance, if this employee has a picture, you can store this picture as a content in his folder, and instead of having iconized picture in Document Library taskflow, you can use dynamic converter to show the actual content of the document selected, same goes for PDF, Word and all extensions supported by Dynamic Converter.
RIDC are really fun to play with, Thanks for this great post, great as always Andrejus

Andrejus Baranovskis said...

Thanks for great feedback :)

Hasim said...

There are 3 kind of interfaces to access UCM

- SAOP Webservices
- Content Integration Suite (CSI)
- Light Weight Remote Intradoc Client(RIDC)

I am happy to see RIDC example , I will love if i can find
something that do the same thing using other two access way.I will try to do it.

This is fantastic stuff to connect to UCM from plain java.

always a great job from andrejus

Andrejus Baranovskis said...

Thats right, however RIDC seems to be the most popular...


Anonymous said...

thank you for information about ridc. Where do you get information about input parameter to the different services?
For example COLLECTION_GET_CONTENTS. Service reference only list the name.


Andrejus Baranovskis said...


Its special Red Samurai trick :)


pawel said...

Very good article. I also use RIDC in my project and I wonder is ther possible to search specified folder by custom metadata? From other hand I specify metadat as input parameter and the function (idoc script if exists) return me a folder id or a list of ID's.
Do you think is it possible?

Andrejus Baranovskis said...

I believe this should be possible, you should check in API, operations for find.


Pranab said...

I have created a XML document as datafile and I converted into a stream, so how could I use this to upload or create a new web asset for a specific REGIONDEFINATION.

I tried by creating a temp xml file, and uploaded to UCM, but this does not work for multiple request. I want to create a new data file for each request inside a folder.

I am looking for SS_CHECKIN_WEB_ASSET idcservice, but unable to found much on it. I believe this is used to create or check in new data file into UCM, which does not need any primary file.


Khad said...

Hi Andrejus

I am using a RIDC DataControl to retrieve the QuickSearch results from UCM. I have configured the below user settings for RIDC:

RIDC Socket Type: socket
Server Host Name: localhost
Content Server Listener Port: 4444
Authentication: Identity Propagation
Username/Password: weblogic/weblogi

But even though I am using "weblogic" user credentials and RIDC socket connection, the logs on the UCM shows as a "CIS connection". Also, the user is coming as "anonymous" rather than "weblogic" (used from Connection Repository) Below are the search logs:

searchquery/7 08.09 15:55:41.195 IdcServer-1320 Query by anonymous from CIS
searchquery/6 08.09 15:55:41.198 IdcServer-1320 preparedQueryText: (xCollectionID > `0` xCollectionID < `0`) (test1)
searchquery/6 08.09 15:55:41.199 IdcServer-1320 Setting substr to other operator conv flag: '(xCollectionID > `0` xCollectionID < `0`) (test1)'
searchquery/6 08.09 15:55:41.199 IdcServer-1320 Parsing universal query: '(xCollectionID > `0` xCollectionID < `0`) (test1)'
searchquery/6 08.09 15:55:41.199 IdcServer-1320 Processing callback on query value '0'
searchquery/6 08.09 15:55:41.199 IdcServer-1320 Processing callback on query value '0'
searchquery/6 08.09 15:55:41.200 IdcServer-1320 Converted native query: '( SDATA(xCollectionID > 0) or SDATA(xCollectionID < 0) ) and ( ((DEFINESCORE((test1), RELEVANCE * .1)) ))'
searchquery/6 08.09 15:55:41.200 IdcServer-1320 query(cache): &QueryText=%28xCollectionID+%3e+%600%60+%3cOR%3e+xCollectionID+%3c+%600%60%29+%3cAND%3e+%28%3cqsch%3etest1%3c%2fqsch%3e%29/((((z5075626C6963) WITHIN zdSecurityGroup))) and ((((idcnull) WITHIN dDocAccount)))//ORACLETEXTSEARCH [1,200]
searchquery/6 08.09 15:55:41.200 IdcServer-1320 Execution time is 5.25 ms.

Is there any further configuration I have to in order to mark the connection as RIDC (either in JDev or UCM) ?


Andrejus Baranovskis said...


You should enable ADF Security for your ADF application, so it will not use "anonymous" user, but "authenticated". As I can see from your error log message.

Identity propagation works only with ADF Security enabled.


Khad said...

Thanks Andrejus. Do you have any step by step guide/blog for adding ADF security (11g) for the page which is built on DataControl?

Andrejus Baranovskis said...

Yes, hope this will help:


Khad said...

Identity propagation happens through the login page. On a successful login, same user credentials are propagated to retrieve the content for the Search.jspx page. I don't think, any additional ADF security configuration need to be added for 11g. I mean, once you configure the Search.jspx page on pages.xml with the required grants Page will be visible once you login to portal from login.jspx.

Andrejus Baranovskis said...

Yes, if you are using WebCenter. But I don't recommend using pages.xml at all, is full of bugs.


Khad said...

Hi Andrejus

Do you have any example or blog on calling Jive Search using REST Web services ? Any suggestions on this is highly appreciated?


Ramesh Chandra said...

Hi Andrejus,

Could you suggest how we automate document upload process in UCM. We have large volume of scanned PDF files more 34,0000 files per day.


Sunil Dhage said...

Hi Andrejus,
I am looking for an example to add content under a folder. I have searched documentation and found "COLLECTION_CHECKIN_NEW" service for my purpose. But the documentation doesnot talk about the required parameters to be passed to this service. Can you please share an example.

Sunil Kumar Dhage

Andrejus Baranovskis said...

I will, on my todo list ;)


Sunil Dhage said...

Hi Andrejus,
I have created a folder using "COLLECTION_ADD". I am able to do "COLLECTION_INFO" on the same folder. But while adding content under the same folder and I am getting "Content item '(null)' was not successfully checked in. Unable to open folder".

public void addContent() {
IdcClient idcClient = null;
try {
idcClient = getIdcClient();

IdcContext userContext = new IdcContext(USER);
DataBinder binder = idcClient.createBinder();
binder.putLocal ("IdcService", "COLLECTION_CHECKIN_NEW");
// get the binder
binder.putLocal ("dDocTitle", "Image file");
binder.putLocal ("dDocName", "3.001");
//binder.putLocal ("dDocAuthor", "Developer");
binder.putLocal ("dDocType", "Document");
binder.putLocal ("dSecurityGroup", "Public");
//binder.putLocal ("createPrimaryMetaFile", "true");
//binder.putLocal ("AllowPrimaryMetaFile", "true");

binder.putLocal("hasParentCollectionID", "true");
//binder.putLocal("dParentCollectionID", "739373434448003843");
binder.putLocal("dParentCollectionID", this.getFolderIdFromPath(idcClient, userContext, PATH));
// add a file

binder.addFile ("primaryFile", new TransferFile(new File("D:\\P6WS\\RIDC Test\\src\\com\\oracle\\ridc\\poc\\3.jpg")));

// checkin the file

ServiceResponse response = idcClient.sendRequest(userContext, binder);
DataBinder serverBinder = response.getResponseAsBinder();

String dAction = serverBinder.getLocal("dAction");
System.out.println("the dAction "+dAction);
Map localData = serverBinder.getLocalData();
for( Object key : localData.keySet()) {
System.out.println(" Key "+key +" Value "+localData.get(key));
} catch (IOException e) {
System.err.println(" Error due to "+e.getMessage());
} catch (IdcClientException e) {
System.err.println(" Error due to "+e.getMessage());

Anonymous said...

use chekin universal service and provide the metadata xCollection id.Then i belive it sits in the sepcified dont need this much coding stuff

raj said...

Hi Andrejus,

tried to run this aplicastion but got this exception

Target URL --
UCM user weblogic was specified as typeShapeUser and does not exist for repository UCMFileStore. Option list for content type security groups may be incomplete (calls will be made as anonymous user).
Submission[id=1, service=oracle.webcenter.content.jcr.login, resource=UCMFileStore] caught exception running task
javax.jcr.RepositoryException: Unable to load content server metadata model using GET_DOC_METADATA_INFO.
at oracle.jcr.impl.ExceptionFactory.repository(
at oracle.stellent.jcr.IdcConnection.refreshMetadataModel(
at oracle.stellent.jcr.IdcPersistenceManagerFactory.createPersistenceManager(
at oracle.jcr.impl.OracleRepositoryImpl.login(
at oracle.webcenter.concurrent.Submission$
at Method)
at oracle.webcenter.concurrent.Submission.runAsPrivileged(
at oracle.webcenter.concurrent.Submission$
at java.util.concurrent.Executors$
at java.util.concurrent.FutureTask$Sync.innerRun(
at oracle.webcenter.concurrent.ModifiedThreadPoolExecutor$Worker.runTask(
at oracle.webcenter.concurrent.ModifiedThreadPoolExecutor$
Caused by: oracle.stellent.ridc.protocol.http.HttpProtocolException: Form validation failed
at oracle.stellent.ridc.protocol.http.auth.FormAuthHandler.throwFormValidateException(
at oracle.stellent.ridc.protocol.http.auth.FormAuthHandler.handleFormResponse(

... 16 more

can you help.


Andrejus Baranovskis said...

I see you are using weblogic user to test, do you have such user in UCM?


Anonymous said...

Hi, i am new to RIDC thingy and would like to start a project with it. May i know more about the "getFolderIdFromPath" function and what kind of PATH to be expected eg. the folder and actual example?

Andrejus Baranovskis said...

You can download example from this blog.


Anonymous said...


The Oracle® Universal Content Management Services Reference Guide 11g Document is not a complete reference , and i have many problems with this guide .

do you have any better guide?

can you help me (please .........)


leong said...

Thanks!! you helps me a lot!

Anton Kabachkov said...

Hello, I have a problem with this example.
<[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <> <> <352b2f8e7566887c:-36694a18:13b09a8e815:-8000-00000000000001a8> <1353078105110> <[ServletContext@350520588[app:UCMNewFolder_application1 module:UCMNewFolder-ViewController-context-root path:/UCMNewFolder-ViewController-context-root spec-version:2.5 version:V2.0]] Servlet failed with Exception
at oracle.adf.model.binding.DCIteratorBinding.executeQueryIfNeeded(
at oracle.adf.model.binding.DCBindingContainer.internalRefreshControl(
at oracle.adf.model.binding.DCBindingContainer.refresh(
at oracle.adf.controller.v2.lifecycle.PageLifecycleImpl.prepareModel(
at oracle.adf.controller.v2.lifecycle.Lifecycle$2.execute(
at oracle.adfinternal.controller.lifecycle.LifecycleImpl.executePhase(
at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener.access$400(
at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener$PhaseInvokerImpl.startPageLifecycle(
at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener$1.after(

Can anyone suggest me, please?

Andrejus Baranovskis said...

Looks like connection to the DB failed, do you have HR schema?


mahendra said...

I am tring to Approve/Reject a workflow using RIDC. There seems to be a bug in the API. It allows my to Approve using the superuser (Weblogic). The API throws a valid error while rejecting as weblogic, but it throws a form validation error when I create user context using actual reviewer. Any suggestions?


Suman Vadlamudi said...

Hi friends,

How we can integrate BPM and UCM using RIDC API.

I know we need to Connect to UCM server
Fetch the DOC
Close the connection.

So can u provide code using BPEL based Embedded activity.


Andrejus Baranovskis said...


I would suggest to integrate from ADF attached to BPM, don't integrate directly into BPM flow. Basically you would need to build ADF UI Task Form with UCM access.

This is on my TODO list to show how with sample app.


Pavan kumar said...

hi Andrejus,

I have the same requirement...

I requirement goes this way..

I need to Connect UCM server of my client machine.

Download the Document and Show it in ADF Screen.

Close the connections.

I've created the Java Class to connect to UCM using RIDC.

Now i need to Download the PDf file and Need to Show it in ADF UI.

Can u plz give sample example on this.. i've to deliver soon.


Vijayalakshmi said...

Hi andreju,

I am trying to upload a document to UCM

below is the code

IdcClientManager manager = new IdcClientManager();
IdcClient idcClient = manager.createClient(connection);
IdcContext userContext = new IdcContext(username, password);
DataBinder binder = idcClient.createBinder();
binder.putLocal("IdcService", "CHECKIN_UNIVERSAL");
binder.putLocal("dDocTitle", title);
binder.putLocal("dDocName", name);
binder.putLocal("dDocType", type);
binder.putLocal("xCollectionID", Long.toString(folder));
binder.putLocal("dSecurityGroup", "Public");
binder.putLocal("hasParentCollectionID", "true");

binder.addFile("primaryFile", file);

ServiceResponse response = idcClient.sendRequest(userContext, binder);
DataBinder serverBinder = response.getResponseAsBinder();

But i get an exception

oracle.stellent.ridc.protocol.ProtocolException: Read error
at oracle.stellent.ridc.protocol.http.IdcHttpProtocol.sendRequest(
at oracle.stellent.ridc.protocol.http.auth.FormAuthHandler.sendAuthenticatedRequest(
at oracle.stellent.ridc.protocol.http.IdcHttpProtocol.writeRequest(
at oracle.stellent.ridc.IdcClient.sendRequest(
at view.UCM_API.uploadDocument(
at view.backing.DocUpload.uploadListener(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at com.sun.el.parser.AstValue.invoke(Unknown Source)
at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodExpression(
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(
at javax.faces.webapp.FacesServlet.service(
at weblogic.servlet.internal.StubSecurityHelper$
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(
at weblogic.servlet.internal.ServletStubImpl.execute(
at weblogic.servlet.internal.TailFilter.doFilter(
at weblogic.servlet.internal.FilterChainImpl.doFilter(
at weblogic.servlet.internal.FilterChainImpl.doFilter(
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(
at weblogic.servlet.internal.FilterChainImpl.doFilter(
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(
at org.apache.myfaces.trinidad.webapp

Can you please tell me whats the issue in the code.

Siva Sankar said...

Hi Andrejus,

I am implemented the same in webcenter portal application.but I am facing some issue while using treebavigation on leftside of the document manager taskflow.Once I used that when I click in employee the document manager is not rendering.illegalStateExpetion.
ppr problem.if i ran your application its running fine.
I am using jdev and webcenter as version.

please suggest me solution.
below type of error i am getting

please give me some solution.


Siva Sankar