Wednesday, August 31, 2016

Documentum custom dfs jar generation

Documentum provides documentum foundation services (DFS) jars to talk to the CMS for querying, uploading files. This functionality broke after we have upgraded to JBOSS EAP6 with CXF webservice stack.

We have generated the DFS client using the webservice urls

By using CXF wsconsume
C:\dev\dctm_client>C:\tools\jboss-eap-6.2.0\bin\wsconsume.bat -k http://ecmsvc-sys.xxy.com/emc-dfs/services/core/ObjectService?WSDL -b simple-binding.xml
C:\dev\dctm_client>C:\tools\jboss-eap-6.2.0\bin\wsconsume.bat -k http://ecmsvc-sys.xxy.com/emc-dfs/services/core/SchemaService?WSDL -b simple-binding.xml
C:\dev\dctm_client>C:\tools\jboss-eap-6.2.0\bin\wsconsume.bat -k http://ecmsvc-sys.xxy.com/emc-dfs/services/core/QueryService?WSDL -b simple-binding.xml
C:\dev\dctm_client>C:\tools\jboss-eap-6.2.0\bin\wsconsume.bat -k http://ecmsvc-sys.xxy.com/emc-dfs/services/core/runtime/ContextRegistryService?wsdl -b simple-binding.xml


By using native JAXWS wsimport
c:\Java\jdk1.7.0_60\bin\wsimport.exe http://ecmsvc-sys.xxy.com/emc-dfs/services/core/runtime/ContextRegistryService?wsdl -keep -nocompile -b simple-binding.xml
c:\Java\jdk1.7.0_60\bin\wsimport.exe http://ecmsvc-sys.xxy.com/emc-dfs/services/core/SchemaService?WSDL -keep -nocompile -b simple-binding.xml
c:\Java\jdk1.7.0_60\bin\wsimport.exe http://ecmsvc-sys.xxy.com/emc-dfs/services/core/ObjectService?WSDL -keep -nocompile -b simple-binding.xml
c:\Java\jdk1.7.0_60\bin\wsimport.exe http://ecmsvc-sys.xxy.com/emc-dfs/services/core/QueryService?WSDL -keep -nocompile -b simple-binding.xml

And sample-binding.xml
<jaxb:bindings
    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.0"
    xmlns:xjc= "http://java.sun.com/xml/ns/jaxb/xjc"
    jaxb:extensionBindingPrefixes="xjc">
    <jaxb:globalBindings>
        <xjc:simple />
    </jaxb:globalBindings>
</jaxb:bindings>

After generating client and bundled into jar (below pom.xml) dfs services worked perfectly with Jboss EAP6. Also the manual steps can be automated by using maven wsimport and wsconsume plugins.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.emc.dfs</groupId>
<artifactId>dfs-cxf-client</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1-redhat-2</version>
</dependency>

<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.11</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>redhat-techpreview-all-repository</id>
<name>Red Hat Tech Preview repository (all)</name>
<url>http://maven.repository.redhat.com/techpreview/all/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>daily</updatePolicy>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>redhat-techpreview-all-repository</id>
<name>Red Hat Tech Preview repository (all)</name>
<url>http://maven.repository.redhat.com/techpreview/all/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>daily</updatePolicy>
</snapshots>
</pluginRepository>
</pluginRepositories>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<file>${project.build.directory}/dfs-cxf-client-1.0.jar</file>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>


To invoke operations on the ObjectService helper use

ObjectServiceHelper helper = new ObjectServiceHelper(dctmCtx.getSvrUser(), dctmCtx.getSvrPwd(),
dctmCtx.getRepositoryName(), dctmCtx.getCtxRegistryUrl(), dctmCtx.getCtxRoot(), ContentTransferMode.BASE_64);
ObjectServicePort serPort =  helper.getServicePort();
And do the actual DFS service operations on the ObjectServicePort
serPort.createPath()
serPort.create(DataPackage)

No comments:

Post a Comment