You are on page 1of 4

Chaining of Custom Services in DFS

There is an interesting drawback in Documentum Foundation Services Version 6.5,


When you chain custom services and try to build the Services the build fails lets see a Scenario
from the DFS sample code itself

import com.emc.documentum.fs.rt.ServiceException;
import com.emc.documentum.fs.rt.ServiceInvocationException;
import com.emc.documentum.fs.rt.annotations.DfsPojoService;
import com.emc.documentum.fs.rt.context.ContextFactory;
import com.emc.documentum.fs.rt.context.IServiceContext;
import com.emc.documentum.fs.rt.context.ServiceFactory;

@DfsPojoService(targetNamespace =
"", requiresAuthentication =
public class HelloWorldService
public String sayHello(String name)

ServiceFactory serviceFactory = ServiceFactory.getInstance();

IServiceContext context =
try {
IAcmeCustomService secondService =
serviceFactory.getService(IAcmeCustomService.class, context);
} catch (ServiceInvocationException e) {

} catch (CustomException e) {

} catch (ServiceException e) {

return "Hello " + name;


Here in the sample code of DFS I am chaining the services, Here everything looks fine and when
you now you build this service during the genarateArtifacts ant task the Build will fail with a will
get a ClassNotFound compiler error at

IAcmeCustomService secondService =
serviceFactory.getService(IAcmeCustomService.class, context);
What happens here is when the build does the initial clean up all the generated Client interfaces
are deleted and DFS currently not checking for any dependencies.

Let me take the example of dfs-build.xml that’s the part of CoreDocumentumProject in composer
<generateArtifacts serviceModel="${gen.src.dir}/${context.root}-
${}-service-model.xml" destdir="${gen.src.dir}/">
<src location="${src.dir}" />

<path refid="projectclasspath.path" />


In this we cannot set any exclusion path in <src location="${src.dir}" />

Simply because it even if you provide <fileset/> or <direst/> with pattern set its not recognizing

I had raised a support case with EMC and they told me that this is not currently supported!!!!
And they will add this as a feature request
This means we cannot Chain Custom Services unless EMC fix this or we do a semi manual
workaround to overcome this issue.

The Work-around that I found

Follow these steps to overcome this issue

Step 1,

Identify the Services those will call the custom services, and create a new source directory for it
in composer, here I am calling them as depended_src and move the services that calls the
custom services to there, the depended src should be in a separate path than the webservices-
Step 2

1) Now Edit the Build file and add these two properties

<property name=""
value="${service.projectdir}/Web Services/bin/classes" />

<property name="dep.src.dir" value="${service.projectdir}/depended_src"


The dep.src.dir should point to the depended src location mentioned in step 1

2) Create an additional target for generatemodel and generate artifacts

<target name="generateDependencies" depends="generate">

<echo message="Calling generateDependencies" />
<generateModel contextRoot="${context.root}"
moduleName="${}" destdir="${gen.src.dir}/">
<fileset dir="${dep.src.dir}">
<include name="**/*.java" />
location="${}" />
<path refid="projectclasspath.path" />

<generateArtifacts serviceModel="${gen.src.dir}/${context.root}-
${}-service-model.xml" destdir="${gen.src.dir}/">
<src location="${dep.src.dir}" />
<path refid="projectclasspath.path" />
<!-- signal build is done -->
<!-- used by -->
<copy todir="${src.dir}/../" file="${basedir}/dfs-
builddone.flag" />

3) Now edit dfs-build.properteis and add the following property

service.projectdir= <absolute path to the project>

Step 3

1) Run the generate task,

2) Copy all the service entries from (between <module> and </module><context-
root>-<module-name>-service-model.xml you can find this in <project_dir>\Web
Services\bin\gen-src folder

3) Now run the generateDependencies task that was created on Step 2

4) Now Edit <context-root>-<module-name>-service-model.xml and add the

copied services to this file

5) If you want to create the jar files now you can call the package task after this.

This should help you to chain custom services , and if you found any alternate ways please