Need Sample Code to Trigger workflow Using D2FS

vijaysince89
edited August 28, 2017 in Documentum #1

Hi All,

          I need a sample program to trigger a workflow in D2 using D2FS.

Thank you in advance.

Best Answer

  • Antal Bos
    edited October 22, 2013 #2 Answer ✓

    See attachment for sample code; This is created on D2 4.1

    The libraries i use are:

    • C6-Common.jar
    • D2-API.jar
    • D2FS-API.jar
    • D2FS4DCTM-API.jar
    • dfc.jar
    • spring-%.jar

Answers

  • Antal Bos
    edited October 21, 2013 #3

    Hi,

    We had a good discussion on this feature in this post: https://community.emc.com/message/737530#737530

    But what is your functional requirement because it's also possible to start a process from the D2LifecycleBatchJob job.

    Best regards,

    Antal

  • vijaysince89
    edited October 21, 2013 #4

    Hi Antal,

              Thanks for the reply. I'm creating the content using Custom widget that I've designed using DFC. After creation of main content I need to push the document in to a workflow. I tried using DFC but its throwing an error dialog box with out any message. So I thought of using D2FS to send the document to workflow. I've seen the discussion link you sent. Can you provide me only the code that I need for this function ? and also what are all the jars I need to keep in the library ?

    Thanks.

  • Antal Bos
    edited October 22, 2013 #5 Answer ✓

    See attachment for sample code; This is created on D2 4.1

    The libraries i use are:

    • C6-Common.jar
    • D2-API.jar
    • D2FS-API.jar
    • D2FS4DCTM-API.jar
    • dfc.jar
    • spring-%.jar
  • vijaysince89
    edited October 22, 2013 #6

    Hi Antal,

              Thanks for your help. I've sent document to workflow. But before that I have to apply the D2 Lifecycle to the document so that the state changes based on the workflow activity.

    Thanks,

  • Antal Bos
    edited October 22, 2013 #7

    Then i would call this method and start the workflow from a lifecycle-action in D2-Config.

    private void attachLC(String strId){

      Context context = new Context();

      context.setLogin("dmadmin");

      context.setPassword("admin");

      Repository repos = new Repository();

      repos.setId("D7");

      repos.setRepositoryName("D7");

      repos.setRepositoryType("DOCUMENTUM");

      repos.setServerName("Win2k8SQL2k8D67");

      repos.setDocbaseDescription("Documentum 6.7 Repository");

      repos.setServerVersion("6.7.0000.0217  Win32.SQLServer");

      context.setRepository(repos);

      context.setClientHostName("server");

      context.setClientIp("127.0.0.1");

      context.setUid("qwesdrfghj");

      ChangeStateRequest stateRequest = new ChangeStateRequest();

      stateRequest.setId(strId);

      stateRequest.setContext(context);

      stateRequest.setTargetState("Imported");

      stateRequest.setOperation("start");

         final ChangeStateResponse stateresponse =

          (ChangeStateResponse)new D2FSWebServiceSupport().getWebServiceTemplate().marshalSendAndReceive(stateRequest);

      }

  • Nitesh
    edited October 30, 2013 #8

    Hi Antal,

    I tried to use the workflow sample class you attached but the method setWebServiceTemplate that is being called from D2FSWebServiceSupport class is not defined. Can you please send the code for that

    Regards,

    Nitesh

  • Antal Bos
    edited October 30, 2013 #9

    This is no custom code, but a standard method in class org.springframework.ws.client.core.support.WebServiceGatewaySupport.setWebServiceTemplate(WebServiceTemplate webServiceTemplate)

    See spring-ws-core-2.0.4.RELEASE.jar

  • Nitesh
    edited October 30, 2013 #10

    Hi Antal,

    Can you please tell us the full name of the spring jar

  • vijaysince89
    edited October 30, 2013 #11

    Hi Antal,

              Even I'm facing the same problem. I've used the following jars.

    1. spring-1.2.8.jar
    2. spring-ws-core-2.0.4.RELEASE.jar

         But still setWebServiceTemplate function is unresolved.

    What to do ?

  • Antal Bos
    edited October 30, 2013 #12

    These are the Sping-jars on my classpath. They are all copied from the D2\WEB-INF\lib directory.

    Spring jars.PNG.png

  • Nitesh
    edited October 31, 2013 #13

    Thanks  alot Antal for your quick replies. I was able to remove errors related to spring framework. Now I am facing below error while running the code.

    org.springframework.ws.client.WebServiceIOException: I/O error: Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect

    at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:543)

    at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:384)

    at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:378)

    at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:370)

    at StartWorkflow.startWf(StartWorkflow.java:119)

    at StartWorkflow.main(StartWorkflow.java:30)

    I am not 2 proficient with web services so unable to get what may be wrong

    Regards,

    Nitesh

  • vijaysince89
    edited October 31, 2013 #14

    Hi Nitesh & Antal,

                   Even I'm facing the problem. We are on the same page Nitesh.

  • Antal Bos
    edited October 31, 2013 #15

    Check this setting in the applicationContext.xml

    <property name="defaultUri" value="http://localhost:8090/D2FS/ws" />

    You probably need to change the defaultUri to something like: http://<APP_SERVER_HOST>:<APP_SERVER_PORT>/D2/ws

    Also see if you get result back on this url: http://<APP_SERVER_HOST>:<APP_SERVER_PORT>/D2/ws/d2fs.wsdl

    e.g. http://localhost:8080/D2/ws/d2fs.wsdl

    I included D:\Documentum\User\config on the classpath; inhere i have my dfc.properties, but also that applicationContext.xml

    Hopefully this helps you both guys further.

  • Nitesh
    edited November 4, 2013 #16

    Thanks for all your help Antal

    I was successfully able to start workflow and apply lifecycle

    Regards,

    Nitesh

  • Antal Bos
    edited November 4, 2013 #17

    You're welkom!

    I hope vijaysince89 could also solve his problem with this information.

    Best regards,

    Antal

  • vkpandey
    edited August 6, 2014 #18

    Hi,

    How did we resolve D2FSWebServiceSupport issue. This isn't in any jar. I have added all the jars mentioned in the build path. Are there any other steps to resolve it. Please reply

    -Vivek

  • Antal Bos
    edited August 6, 2014 #19

    D2FSWebServiceSupport is a custom (inner) class that extends from WebServiceGatewaySupport.

    See the startWorkflow.java sample file I attached in a previous reply.

  • vkpandey
    edited August 7, 2014 #20

    Thanks Antal for your reply.

    I tried using that inner class now, but what are these files and how could i get them

    private static final String BEANS_XML_FILE = "applicationContext.xml";

      private static final String WEBSERVICETEMPLATE_BEAN_ID = "webServiceTemplate";

    Also, as you replied my other post too, i blv i could use ID2LifecycleService implementation and call changeState method directly as well, was able to change lifecycle state using this. Just a curious question yet, what are these files??

  • Antal Bos
    edited August 7, 2014 #21

    The applicationContext.xml should be available on the classpath for the application from where you run your customization; We have some custom modules running by the JMS, so we copied the XML to the classpath on the JMS.

    A sample of the XML can be found in your D2 webapp on the application server: D2\WEB-INF\classes

    In here you will find that 'webServiceTemplate' bean; This is Spring framework functionality (http://docs.spring.io/spring-ws/site/reference/html/client.html).

    When calling D2FS from custom code this URL will also be handy: http://<HOST>:<PORT>/D2/ws/d2fs.wsdl

  • vinay_goli
    edited January 28, 2017 #22

    Dear HetBenkt,

    we still facing issue finding the location to put application context in classpath on JMS, can you please explain more where exactly to put this file.

    Thanks.

  • EktaVegad
    edited August 28, 2017 #23

    Dear HetBenkt,

    We tried the same, workflow is started successfully but task is coming to workflow supervisor.

    Because alias is not getting resolved. Kindly let us know how to assign the performers in alias.

    If any one else had same issue, let us know how to resolve it.

    Regards,

    Ekta

  • Is there any D2fs code to call the Workflow Services in D2.

  • Is there any D2fs code to call the Workflow Services in D2 ?

    Does someone has any sample ?