Some persons from EMC Documentum Forums stated that AcmeCustomService which comes with DFS SDK seems to be too complex for beginners, and “HelloWorld” service would be more understandable. I will try to show you how to create your first own simple HelloWorld like DFS service.
This tutorial will contain of 3 parts:
Before we’ll start, we should setup our build environment.
Note: You should have ant installed in order to run tutorial scripts.
1. Download attached helloworldservice.zip and extract it into emc-dfs-sdk-6.0\samples folder. It contains project template similar to AcmeCustomService. Lets assume “HelloWorldService” folder as root.
2. Open etc\dfc.properties and set host, repository name, username and password for your docbase.
3. Open build.properties and set preferred context root and module names, or leave them as they’re now.
Here is service code:
package com.service.example;
import com.emc.documentum.fs.rt.annotations.DfsPojoService;
@DfsPojoService(targetNamespace = “http://example.service.com”, requiresAuthentication = true)
public class HelloWorldService
{
public String sayHello(String name)
{
return “Hello ” + name;
}
}
@DfsPojoService annotation specifies service’s namespace, and states if service requires docbase authentication (true by default)
Place this source with appropriate package into src\service folder.
Go to root folder (HelloWorldService) and run from command line the following command:
ant artifacts package
This command converts annotated classes to DFS services and package them into ear file.
At this step, you should have example.ear deployment file in HelloWorldService\build folder. This ear file contains our service which can be deployed into Weblogic application server.
Copy this file into weblogic’s autodeploy directory. You can also set weblogic deployment dir at autodeploy.properties file and run “ant deploy” command.
With default values at build.properties, your service should be available by the path: http://host:port/services/example/HelloWorldService
That’s all for now. In the next part of tutorial I will explain how to create client and call this service remotely.
23 Responses
Custom DFS service development. Java client. Part 2. by DFS Notes
November 20th, 2007 at 3:20 pm
1[…] Today we’ll talk about remote client creation which invokes our HelloWorldService from part 1. […]
DFS tutorial
January 17th, 2008 at 10:08 am
2[…] Part 1 - Environment setup for DFS SDK and (”Hello World”) service creation […]
ingbabic
January 18th, 2008 at 1:24 pm
3Hello Sergey
Thanks for providing this tutorial. It is very informative, but I have some questions, regarding this:
1) How did you create projects structure provided in helloworldservice.zip (I mean those directories, like src, etc, resources, and those files in root of the project? Is it a must to have such a project structure? Could we use Documentum composer for writing custom services? Is there any wizard provided for creating this kind of project?
2) You said that we should copy sample project into samples dir of dfs sdk folder. Why? Is it a must?
3) I don’t have DFS server standalone, instead I am using one provided with content server. Could we deploy EAR on content server’s BEA (Documentum java method server)? I tried it but without success.
Thanks
admin
January 18th, 2008 at 6:56 pm
4Hi,
1) I took AcmeCustomService from dfs-sdk, changed it and used as template.
2) I said it because ant script uses libraries from dfs-sdk. It is a must until you’ll change ant build.xml script.
3) Technically yes, there is no restrictions, however BEA webserver should include latest patches. DFS server has them and I doubt if Java Method Server has them too. What errors did you get with deploying EAR to Java Method Server ?
sylvia
January 19th, 2008 at 9:18 am
5hi, I run “ant artifacts package”
got java.lang.NoClassDefFoundError at destdir.. (see below)
Any ideas?
admin
January 19th, 2008 at 10:51 pm
6Sylvia,
Did you unpack contents of archive directly to dfs-sdk\samples folder ?
If yes, than most likely you have incorrect dfs.sdk.home value in build.properties file so it cant find ant tasks.
sylvia
January 20th, 2008 at 7:57 am
7Hi,
Yes… my sdk is C:\emc-dfs-sdk-6.0\
and HelloWorldService location is C:\emc-dfs-sdk-6.0\samples\HelloWorldService
I have ant 1.7.0 installed.
below is the output
C:\emc-dfs-sdk-6.0\samples\HelloWorldService>ant artifacts package
Buildfile: build.xml
[echo] EMC DFS SDK 6.0 home is ‘../..’
[echo] This project home is ‘C:\emc-dfs-sdk-6.0\samples\HelloWorldService’–beware spaces in this path (JDK issues).
artifacts:
[mkdir] Created dir: C:\emc-dfs-sdk-6.0\samples\HelloWorldService\generated\src
BUILD FAILED
C:\emc-dfs-sdk-6.0\samples\HelloWorldService\build.xml:138: java.lang.NoClassDefFoundError
did I miss anything?
sylvia
January 20th, 2008 at 7:58 am
8btw..
136
sylvia
January 20th, 2008 at 7:59 am
9oops somehow I cannot post comments
generateModel contextRoot=”${context.root}”
moduleName=”${module.name}”
destdir=”${project.artifacts.folder}/src” << line 138
admin
January 20th, 2008 at 2:35 pm
10Can you run “ant -v artifacts” then so I could see more information about error please ?
sylvia
January 20th, 2008 at 11:15 pm
11the following is the output:
C:\emc-dfs-sdk-6.0\samples\HelloWorldService>ant -v artifacts
Apache Ant version 1.7.0 compiled on December 13 2006
Buildfile: build.xml
Detected Java version: 1.5 in: C:\PROGRA~1\Java\jdk1.5.0_11\jre
Detected OS: Windows XP
parsing buildfile C:\emc-dfs-sdk-6.0\samples\HelloWorldService\build.xml with URI = file:/C:/emc-dfs-sdk-6.0/samples/HelloWorldService/build.xml
Project base dir set to: C:\emc-dfs-sdk-6.0\samples\HelloWorldService
[antlib:org.apache.tools.ant] Could not load definitions from resource org/apache/tools/ant/antlib.xml. It could not be found.
[property] Loading C:\emc-dfs-sdk-6.0\samples\HelloWorldService\build.properties
[property] Loading C:\emc-dfs-sdk-6.0\samples\HelloWorldService\autodeploy.properties
[echo] EMC DFS SDK 6.0 home is ‘../..’
[echo] This project home is ‘C:\emc-dfs-sdk-6.0\samples\HelloWorldService’–beware spaces in this path (JDK issues).
Build sequence for target(s) `artifacts’ is [artifacts]
Complete build sequence is [artifacts, info, compile, run.client, run, deploy, clean, package, ]
artifacts:
[mkdir] Skipping C:\emc-dfs-sdk-6.0\samples\HelloWorldService\generated\src because it already exists.
BUILD FAILED
C:\emc-dfs-sdk-6.0\samples\HelloWorldService\build.xml:138: java.lang.NoClassDefFoundError
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:115)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
at org.apache.tools.ant.Main.runBuild(Main.java:698)
at org.apache.tools.ant.Main.startAnt(Main.java:199)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: java.lang.NoClassDefFoundError
at com.emc.documentum.fs.aspects.Tracing.ajc$afterThrowing$com_emc_documentum_fs_aspects_Tracing$3$8b9079b8(Tracing.aj:73)
at com.emc.documentum.fs.rt.impl.configuration.ServiceResourceBundle.getInstance(ServiceResourceBundle.java:47)
at com.emc.documentum.fs.rt.ServiceException.(ServiceException.java:33)
at com.emc.documentum.fs.tools.ServiceCreationException.(ServiceCreationException.java:24)
at com.emc.documentum.fs.tools.impl.ServiceModelGenerator.(ServiceModelGenerator.java:46)
at com.emc.documentum.fs.tools.GenerateModelTask.executeTask(GenerateModelTask.java:145)
at com.emc.documentum.fs.tools.impl.ChainedExceptionReportingTask.execute(ChainedExceptionReportingTask.java:18)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
… 11 more
— Nested Exception —
java.lang.NoClassDefFoundError
at com.emc.documentum.fs.aspects.Tracing.ajc$afterThrowing$com_emc_documentum_fs_aspects_Tracing$3$8b9079b8(Tracing.aj:73)
at com.emc.documentum.fs.rt.impl.configuration.ServiceResourceBundle.getInstance(ServiceResourceBundle.java:47)
at com.emc.documentum.fs.rt.ServiceException.(ServiceException.java:33)
at com.emc.documentum.fs.tools.ServiceCreationException.(ServiceCreationException.java:24)
at com.emc.documentum.fs.tools.impl.ServiceModelGenerator.(ServiceModelGenerator.java:46)
at com.emc.documentum.fs.tools.GenerateModelTask.executeTask(GenerateModelTask.java:145)
at com.emc.documentum.fs.tools.impl.ChainedExceptionReportingTask.execute(ChainedExceptionReportingTask.java:18)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
at org.apache.tools.ant.Main.runBuild(Main.java:698)
at org.apache.tools.ant.Main.startAnt(Main.java:199)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Total time: 0 seconds
admin
January 21st, 2008 at 12:07 am
12Hmm,
Seems pretty strange. What JVM do you have installed ?
sylvia
January 21st, 2008 at 7:08 am
13C:\emc-dfs-sdk-6.0\samples\HelloWorldService>java -version
java version “1.5.0_14″
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_14-b03)
Java HotSpot(TM) Client VM (build 1.5.0_14-b03, mixed mode, sharing)
I got the DFS SDK from https://emc.subscribenet.com/control/dctm/download?element=785153&displayDetailedLicenseQuantity=null
I noticed in your build.xml, the path for “dfs.sdk.lib” was set to ${dfs.sdk.home}/lib/java, but this SDK does not have “java” folder..
so I copied everything from lib to lib\java
Maybe I got the wrong DFS SDK?
sylvia
January 21st, 2008 at 8:39 am
14ok.. looks like I finally got it working.
I copied build.xml from AcmeCustomService over, and fixed “dfs.sdk.libs”, and I was able to get “build successul”…
ingbabic
January 23rd, 2008 at 3:57 pm
15hi
If I put EAR file in autodeploy directory nothing happens. I read in readme.txt in this dir that BEA must be started in “development” mode for autodeploying. But it seems that BEA on the content server is allways starting in “production” mode and I can’t start it in development mode…
admin
January 23rd, 2008 at 6:40 pm
16Hi ingbabic,
What happens if you try to open http://content_server_url:7001/console ?
In case if weblogic admin panel auth page was opened, you can try to deploy your ear file from this admin panel.
sylvia
January 23rd, 2008 at 9:27 pm
17hi inbabic,
I had the same issue with autodeploy.. so I deployed it from admin console. just FYI.
ingbabic
January 24th, 2008 at 7:50 pm
18Hi Sergey, Sylvia
I tried to deploy with weblogic console and it works. Thanx. If I’m not asking too much, qould you please explain following:
1) Although deployment works, EAR file does not get exploded. Is it ok? Why dfs.ear is exploded?
2) When I want to upload my EAR it gets uploaded to adminServer upload directory. How can I tell to put it in MethodServer’s upload directory?
3) What type to choose for my EAR (Application or Library)? I choosed Application (default) and it works.
Tony
February 1st, 2008 at 12:39 am
19Hi
I’m a veteran DFC developer but I’m new to SOA and DFS. I want to create a simple application in eclipse that consumes the out-of-the-box DFS web services that I already have installed with D6 content server. Does anyone know how to get something like that up and running in eclipse? I need to know what (if any) jar files are needed in my classpath, etc. I was able to generate stubs from the WSDLs that are on the BEA method server, but I’m not sure if that’s the correct path either. Can someone offer some insight?
Thanks!
Tony
chauhan.sachinkr
February 22nd, 2008 at 6:50 pm
20If anyone has used @DfsBofService please share the steps to access the SBo from the DFS ..
garg
March 17th, 2008 at 6:00 pm
21hi sylvia,
i am also getting the same errors as you got and i also copy the acmecustomservice build.xml file to HelloWorldService, made changes to ${dfs.sdk.lib}…but still get this error when try…..can anyone help me how to handle this error…and how to run HelloworldService sample…..
C:\emc-dfs-sdk-6.0\samples\HelloWorldService>ant artifacts package
Buildfile: build.xml
[echo] EMC DFS SDK 6.0 home is ‘../..’
[echo] Emc DFS SDK 6.0 lib is ‘../../lib’
[echo] This project home is ‘C:\emc-dfs-sdk-6.0\samples\HelloWorldService’–beware spaces in th
is path (JDK issues).
artifacts:
BUILD FAILED
C:\emc-dfs-sdk-6.0\samples\HelloWorldService\build.xml:120: java.lang.UnsupportedClassVersionError:
com/emc/documentum/fs/tools/GenerateModelTask (Unsupported major.minor version 49.0)
Total time: 0 seconds
jollyca
April 2nd, 2008 at 4:45 pm
22Do you have some non-SDK client development example ? In 80% of the cases we need to integrate with our customer’s environment, and their developers are not happy with learning yet_another_SDK just to invoke some web-services.
admin
April 3rd, 2008 at 1:59 am
23jollyca,
In what language do you need an example ?
RSS feed for comments on this post · TrackBack URI
Leave a reply
You must be logged in to post a comment.
Categories
Archives
Links
Meta
Calendar
Recent Entries
Recent Comments
Most Commented
DFS Notes is proudly powered by WordPress - BloggingPro theme by: Design Disease