11 Replies Latest reply on Oct 31, 2008 10:47 AM by Dhanush Gopinath

    Starting a Process Through API

    Dhanush Gopinath Newbie

      Hi,

      I understand that when a BPEL process is deployed the Application Server(AS) hosts the webservice to start that process, and we make a webservice call to that WS to start the process.

      Is there a way to start the process through the API's ? Does ProcessDefinition class's createProcessInstance() method starts a process.

      Please let me know your inputs.

      Thanks in Advance
      Dhanush

        • 1. Re: Starting a Process Through API
          Mauricio Salatino Master

          You can create a newProcessInstance with the JbpmContext.newProcessInstance() method...

          • 2. Re: Starting a Process Through API
            Dhanush Gopinath Newbie

            But it cannot receive any inputs right.

            Suppose if my start activity is a , then how will I instantiate the input variable.

            Is this actually possible?

            Thanks
            Dhanush

            • 3. Re: Starting a Process Through API
              Mauricio Salatino Master

              Yes, it is possible.
              When you create a new ProcessInstance object the process not begin inmediately..
              You can put your variables and then signal it to start.
              Something like this:

              ProcessInstance pi=JbpmContext.newProcessInstance("processname");
              pi.getContextInstance().setVariable("var1", new Integer(1));
              pi.signal(); -> this will start your process..
              


              • 4. Re: Starting a Process Through API
                Dhanush Gopinath Newbie

                No luck .. I got this exception.. Any inputs

                org.jbpm.JbpmException: token 'Token(/)' can't be signalled cause it is currently not positioned in a node

                • 5. Re: Starting a Process Through API
                  Mauricio Salatino Master

                  Are you sure that you create a newProcessInstance???
                  Because look when this exception is thrown:

                   if (node==null) {
                   throw new JbpmException("token '" + this + "' can't be signalled cause it is currently not positioned in a node");
                   }
                  


                  This means that your actual node is null when you call the signal method.
                  Can you show us your process??
                  and the code that you are using to start it?

                  • 6. Re: Starting a Process Through API
                    Dhanush Gopinath Newbie

                    The process is this :

                    <?xml version="1.0" encoding="UTF-8"?>
                    <process
                     name="Workflow1"
                     targetNamespace="http://www.altair.com/EPM/BPEL/Workflow1"
                     xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
                     xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                     xmlns:tns="http://www.altair.com/EPM/BPEL/Workflow1" xmlns:ns0="http://www.altair.com/EPM/Workflow1Dataschema"
                     xmlns:ns1="http://www.altair.com/WF/Framework/HumanTaskDataSchema" xmlns:ns2="http://www.altair.com/WF/Framework/TaskSchema">
                     <import namespace="http://www.altair.com/EPM/Workflow1" location="Workflow1.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/>
                     <import namespace="http://www.altair.com/EPM/Workflow1InvokeBatchMesh" location="Workflow1InvokeBatchMesh.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/>
                     <import namespace="http://www.altair.com/WF/Framework/HumanTaskDataSchema" location="HumanTaskDataSchema.xsd" importType="http://www.w3.org/2001/XMLSchema"/>
                     <partnerLinks>
                     <partnerLink name="BatchMeshPL" xmlns:tns="http://www.altair.com/EPM/Workflow1InvokeBatchMesh" partnerLinkType="tns:Workflow1BatchMeshPLT" myRole="Workflow1ReceivePortTypeRole" partnerRole="Workflow1InvokeBatchMeshPortTypeRole"/>
                     <partnerLink name="StartWorkflowPL" xmlns:tns="http://www.altair.com/EPM/Workflow1" partnerLinkType="tns:Workflow1PLT" myRole="Workflow1PortTypeRole"/>
                     </partnerLinks>
                     <variables>
                     <variable name="humanTask" type="ns1:HumanTaskComplexType"/>
                     <variable name="StartWorkflowOut" xmlns:tns="http://www.altair.com/EPM/Workflow1" messageType="tns:Workflow1ReplyResponse"/>
                     <variable name="StartWorkflowIn" xmlns:tns="http://www.altair.com/EPM/Workflow1" messageType="tns:Workflow1StartRequest"/>
                     <variable name="ReceiveMeshFileIn" xmlns:tns="http://www.altair.com/EPM/Workflow1InvokeBatchMesh" messageType="tns:ReceiveBMS"/>
                     <variable name="BatchMeshOut" xmlns:tns="http://www.altair.com/EPM/Workflow1InvokeBatchMesh" messageType="tns:InvokeBMSResponse"/>
                     <variable name="BatchMeshIn" xmlns:tns="http://www.altair.com/EPM/Workflow1InvokeBatchMesh" messageType="tns:InvokeBMSRequest"/>
                     </variables>
                     <sequence>
                     <receive name="StartWorkflow" createInstance="yes" partnerLink="StartWorkflowPL" operation="StartWorkflow" xmlns:tns="http://www.altair.com/EPM/Workflow1" portType="tns:Workflow1PortType" variable="StartWorkflowIn"/>
                     <assign name="Assign1">
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns0:meshingData</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns0:meshingData</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns0:meshingData/ns0:partFile1</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns0:meshingData/ns0:partFile1</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns0:meshingData/ns0:partFile2</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns0:meshingData/ns0:partFile2</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns0:meshingData/ns0:meshSize</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns0:meshingData/ns0:meshSize</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskName</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskName</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskID</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskID</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskPriority</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskPriority</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskStatus</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskStatus</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskCreationTime</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskCreationTime</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskCompletionTime</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskCompletionTime</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskPotentialOwners/ns1:group/ns1:id</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskPotentialOwners/ns1:group/ns1:id</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskPotentialOwners/ns1:group/ns1:groupName</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskPotentialOwners/ns1:group/ns1:groupName</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskPotentialOwners/ns1:user/ns1:userID</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskPotentialOwners/ns1:user/ns1:userID</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskPotentialOwners/ns1:user/ns1:firstName</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskPotentialOwners/ns1:user/ns1:firstName</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskPotentialOwners/ns1:user/ns1:lastName</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskPotentialOwners/ns1:user/ns1:lastName</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskPotentialOwners/ns1:user/ns1:userEmail</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskPotentialOwners/ns1:user/ns1:userEmail</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskPotentialOwners/ns1:user/ns1:group/ns1:id</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskPotentialOwners/ns1:user/ns1:group/ns1:id</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskPotentialOwners/ns1:user/ns1:group/ns1:groupName</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskPotentialOwners/ns1:user/ns1:group/ns1:groupName</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskPotentialOwners/ns1:user/ns1:department</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskPotentialOwners/ns1:user/ns1:department</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskPotentialOwners/ns1:multipleUsers/ns1:User/ns1:userID</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskPotentialOwners/ns1:multipleUsers/ns1:User/ns1:userID</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskPotentialOwners/ns1:multipleUsers/ns1:User/ns1:firstName</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskPotentialOwners/ns1:multipleUsers/ns1:User/ns1:firstName</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskPotentialOwners/ns1:multipleUsers/ns1:User/ns1:lastName</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskPotentialOwners/ns1:multipleUsers/ns1:User/ns1:lastName</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskPotentialOwners/ns1:multipleUsers/ns1:User/ns1:userEmail</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskPotentialOwners/ns1:multipleUsers/ns1:User/ns1:userEmail</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskPotentialOwners/ns1:multipleUsers/ns1:User/ns1:group/ns1:id</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskPotentialOwners/ns1:multipleUsers/ns1:User/ns1:group/ns1:id</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskPotentialOwners/ns1:multipleUsers/ns1:User/ns1:group/ns1:groupName</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskPotentialOwners/ns1:multipleUsers/ns1:User/ns1:group/ns1:groupName</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskPotentialOwners/ns1:multipleUsers/ns1:User/ns1:department</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskPotentialOwners/ns1:multipleUsers/ns1:User/ns1:department</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskExcludedOwners/ns1:group/ns1:id</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskExcludedOwners/ns1:group/ns1:id</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskExcludedOwners/ns1:group/ns1:groupName</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskExcludedOwners/ns1:group/ns1:groupName</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskExcludedOwners/ns1:user/ns1:userID</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskExcludedOwners/ns1:user/ns1:userID</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskExcludedOwners/ns1:user/ns1:firstName</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskExcludedOwners/ns1:user/ns1:firstName</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskExcludedOwners/ns1:user/ns1:lastName</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskExcludedOwners/ns1:user/ns1:lastName</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskExcludedOwners/ns1:user/ns1:userEmail</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskExcludedOwners/ns1:user/ns1:userEmail</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskExcludedOwners/ns1:user/ns1:group/ns1:id</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskExcludedOwners/ns1:user/ns1:group/ns1:id</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskExcludedOwners/ns1:user/ns1:group/ns1:groupName</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskExcludedOwners/ns1:user/ns1:group/ns1:groupName</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskExcludedOwners/ns1:user/ns1:department</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskExcludedOwners/ns1:user/ns1:department</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskExcludedOwners/ns1:multipleUsers/ns1:User/ns1:userID</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskExcludedOwners/ns1:multipleUsers/ns1:User/ns1:userID</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskExcludedOwners/ns1:multipleUsers/ns1:User/ns1:firstName</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskExcludedOwners/ns1:multipleUsers/ns1:User/ns1:firstName</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskExcludedOwners/ns1:multipleUsers/ns1:User/ns1:lastName</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskExcludedOwners/ns1:multipleUsers/ns1:User/ns1:lastName</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskExcludedOwners/ns1:multipleUsers/ns1:User/ns1:userEmail</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskExcludedOwners/ns1:multipleUsers/ns1:User/ns1:userEmail</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskExcludedOwners/ns1:multipleUsers/ns1:User/ns1:group/ns1:id</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskExcludedOwners/ns1:multipleUsers/ns1:User/ns1:group/ns1:id</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskExcludedOwners/ns1:multipleUsers/ns1:User/ns1:group/ns1:groupName</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskExcludedOwners/ns1:multipleUsers/ns1:User/ns1:group/ns1:groupName</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskExcludedOwners/ns1:multipleUsers/ns1:User/ns1:department</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskExcludedOwners/ns1:multipleUsers/ns1:User/ns1:department</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskComments/ns1:id</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskComments/ns1:id</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskComments/ns1:addedAt</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskComments/ns1:addedAt</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskComments/ns1:addedBy/ns1:userID</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskComments/ns1:addedBy/ns1:userID</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskComments/ns1:addedBy/ns1:firstName</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskComments/ns1:addedBy/ns1:firstName</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskComments/ns1:addedBy/ns1:lastName</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskComments/ns1:addedBy/ns1:lastName</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskComments/ns1:addedBy/ns1:userEmail</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskComments/ns1:addedBy/ns1:userEmail</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskComments/ns1:addedBy/ns1:group/ns1:id</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskComments/ns1:addedBy/ns1:group/ns1:id</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskComments/ns1:addedBy/ns1:group/ns1:groupName</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskComments/ns1:addedBy/ns1:group/ns1:groupName</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskComments/ns1:addedBy/ns1:department</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskComments/ns1:addedBy/ns1:department</to>
                     </copy>
                     <copy>
                     <from>$StartWorkflowIn.Workflow1StartRequestPart/ns1:humanTaskInfo/ns1:taskComments/ns1:text</from>
                     <to>$BatchMeshIn.InvokeBMSRequestPart/ns1:humanTaskInfo/ns1:taskComments/ns1:text</to>
                     </copy>
                     </assign>
                     <invoke name="BatchMeshHumanTask" partnerLink="BatchMeshPL" operation="BatchMesh" xmlns:tns="http://www.altair.com/EPM/Workflow1InvokeBatchMesh" portType="tns:Workflow1InvokeBatchMeshPortType" inputVariable="BatchMeshIn" outputVariable="BatchMeshOut"/>
                     <receive name="ReceiveMeshFile" createInstance="no" partnerLink="BatchMeshPL" operation="ReceiveMeshFile" xmlns:tns="http://www.altair.com/EPM/Workflow1InvokeBatchMesh" portType="tns:Workflow1ReceivePortType" variable="ReceiveMeshFileIn"/>
                     <assign name="Assign2">
                     <copy>
                     <from>$ReceiveMeshFileIn.ReceiveBMSPart/ns0:task/ns2:taskIsHuman</from>
                     <to>$StartWorkflowOut.Workflow1ReplyResponsePart/ns0:done</to>
                     </copy>
                     </assign>
                     <reply name="Reply1" partnerLink="StartWorkflowPL" operation="StartWorkflow" xmlns:tns="http://www.altair.com/EPM/Workflow1" portType="tns:Workflow1PortType" variable="StartWorkflowOut"/>
                     </sequence>
                    </process>
                    


                    And the code is this :

                    JbpmConfiguration jbpmConfiguration = JbpmConfiguration
                     .getInstance();
                     JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
                     BpelGraphSession graphSession = BpelGraphSession
                     .getContextInstance(jbpmContext);
                    
                     BpelProcessDefinition bpelProcDef = graphSession
                     .findLatestProcessDefinition("ProcessDefinitionName","ProcessDefintiion Target URI";
                    
                     ProcessInstance procInstance = jbpmContext.newProcessInstance("ProcessDefintionName");
                     procInstance.signal();
                     jbpmContext.close();


                    I am not currently setting any input variables, just wanted to see if its starts. I inspected the root token of the procInstance variable and found that its node is null.

                    • 7. Re: Starting a Process Through API
                      Mauricio Salatino Master

                      I have no previously experience with jbpm-bpel, but first of all
                      you need to deploy your process first in order to do:

                      ProcessInstance procInstance = JbpmContext.newProcessInstance("ProcessDefintionName");
                      
                      


                      did you try with JbpmContext.deploy(BpelProcessDefinition)?

                      • 8. Re: Starting a Process Through API
                        Dhanush Gopinath Newbie

                        The process is all deployed. The only thing in the code above is that i am trying to find the process def by the name and i do get it.

                        but start doesnt work

                        • 9. Re: Starting a Process Through API
                          Dhanush Gopinath Newbie

                          Any updates? I would also like to know how to call a normal receive task through API's.

                          Thanks in Advance.

                          Dhanush

                          • 10. Re: Starting a Process Through API
                            Mauricio Salatino Master

                            try to remove the following lines:

                            BpelGraphSession graphSession = BpelGraphSession
                             .getContextInstance(jbpmContext);
                            
                             BpelProcessDefinition bpelProcDef = graphSession
                             .findLatestProcessDefinition("ProcessDefinitionName","ProcessDefintiion Target URI";
                            


                            if you have the process definition deployed the newProcessInstance method find your process definition and then you can signal it.

                            Also, are you sure that your process definition is correctly deployed?


                            • 11. Re: Starting a Process Through API
                              Dhanush Gopinath Newbie

                              That also gives the same error. And the process def is for sure deployed. Other wise it wont create an instance of process def

                              I was looking into some stuff of code like this.

                              BpelGraphSession graphSession = BpelGraphSession
                               .getContextInstance(jbpmContext);
                              
                               BpelProcessDefinition bpelProcDef = graphSession
                               .findLatestProcessDefinition(procDEfPOJO.getProcessName(),
                               procDEfPOJO.getProcessTargetNamespace().getUri());
                              //
                              // ProcessInstance procInstance = bpelProcDef.createProcessInstance();
                              // Token startToken = procInstance.getRootToken();
                              // startToken.signal();
                               List listNodes = bpelProcDef.getNodes();
                               Map mapNodes = bpelProcDef.getNodesMap();
                              
                               Set mapKey = mapNodes.keySet();
                               Iterator keyIterator = mapKey.iterator();
                               while(keyIterator.hasNext())
                               {
                               Object key = keyIterator.next();
                               Scope obj = (Scope) mapNodes.get(key);
                               List listNodes2 = obj.getNodes();
                              
                               for(int i=0;i<listNodes2.size();i++)
                               {
                               org.jbpm.graph.def.Node node2 = (org.jbpm.graph.def.Node) listNodes2.get(i);
                               System.out.println(((Activity)node2).isInitial()); - PRINTS TRUE HERE
                               if(node2 instanceof Receive)
                               {
                               Receive recieve = (Receive) node2;
                               System.out.println(recieve.getName());
                               }
                               }
                               }



                              And then
                              ProcessInstance procInstance = jbpmContext.newProcessInstance("Workflow1");
                               procInstance.getRootToken().setNode(node2);
                               procInstance.signal();



                              But the object node2 I am getting is a type of Sequence.

                              My Receive Task is inside a Sequence.

                              This much i am able to do.. so i think if i can get the receive activity Node and then set it on the root token it should work. This is just a guess though.