7 Replies Latest reply on Jan 11, 2012 6:00 AM by surendarmx

    How to invoke a REST API's from BPMN?

    surendarmx

      Hi,

      I am new to jBPM and now I am trying to invoke a REST API from BPMN process.

      Please help me in this process.

      Thanks in advance

        • 1. Re: How to invoke a REST API's from BPMN?
          tsurdilovic
          • 2. Re: How to invoke a REST API's from BPMN?
            surendarmx

            Hi Tihomir,

            Thanks for the reply!

             

            The link that sent by you is explaining about Domain-Specific process. I am not able to identify how to invoke a API from that document.

             

            Could you please help me how to invoke using the Domain-Specific process.

             

            Thanks

            • 3. Re: How to invoke a REST API's from BPMN?
              tsurdilovic

              You could follow the example in section "13.2.4. Executing service nodes" of the same chapter. If your process execution reaches a service node, and you have registered a handler for it, the handler's executeWorkitem method is invoked. At that point you are doing just Java code so you can have it do what you wish.

              • 4. Re: How to invoke a REST API's from BPMN?
                surendarmx

                Yes, I got it!! Let me try doing the things with the help of that example.

                 

                Thanks

                • 5. Re: How to invoke a REST API's from BPMN?
                  surendarmx

                  Hi Tihomir,

                  I am working with the example in the document, I am able to create work definition and use the same in the project.

                  But, while creating a domain specific node to execute Java, I got an error alert as,

                  "Could not parse work definitions JavaNodeDefinition.conf: java.util.HashMap cannot be cast to java.util.list"

                   

                  Could you please help me in resolving this problem.

                   

                  Thanks in advance

                  • 6. Re: How to invoke a REST API's from BPMN?
                    tsurdilovic

                    Most likely the structure of the MVEL in your .conf or .wid files (workitem config file) is wrong. Can you show it so we can tak a look?

                    • 7. Re: How to invoke a REST API's from BPMN?
                      surendarmx

                      Hi,

                       

                      Thanks for the reply. Here I show how I my MVEL in my conf files

                       

                      drools.rulebase.conf  cintains,

                      "drools.workDefinitions =  JavaNodeDefinition.conf MyWorkDefinitions.conf"

                      and

                      MyWorkDefinitions.conf contains,

                      "

                      import org.drools.process.core.datatype.impl.type.StringDataType;

                      [

                        // the Notification work item

                        [

                          "name" : "Notification",

                          "parameters" : [

                            "Message" : new StringDataType(),

                            "From" : new StringDataType(),

                            "To" : new StringDataType(),

                            "Priority" : new StringDataType(),

                          ],

                          "displayName" : "Notification",

                          "icon" : "icons/star.png"

                        ]

                       

                      ]

                      "

                      JavaNodeDefinition.conf contains,

                      "

                      import org.drools.process.core.datatype.impl.type.StringDataType;

                      [

                        // the Java Node work item located in:

                        // project/src/main/resources/META-INF/JavaNodeDefinition.conf

                        [

                          "name" : "JavaNode",

                          "parameters" : [

                            "class" : new StringDataType(),

                            "method" : new StringDataType(),

                          ],

                          "displayName" : "Java Node",

                          "icon" : "icons/java.gif"

                        ]

                       

                      ]

                      "

                       

                      I have put all this conf files inside "\workspace\Testing\src\main\resources\META-INF" folder