5 Replies Latest reply on Jul 4, 2013 2:59 AM by aarellano

    Web Service client in Jbpm 5.4

    aarellano

      Hi,

       

      I´m trying to integrate a WebService client into my process definition. However I´m in a enterprise environment and we would like to provide a solution easy to use for BPM designers.

       

      My actual arquitecture overview is:

       

      - Server A:

       

           + Guvnor/Drools (we define the Business Process with the designer)

           + Jbpm engine

           + Human Task Service

       

      - Server B:

       

           + Enterprise Web Application (Spring/JPA (Hibernate))

       

      Our web application is able to use the remote Human Task Service to claim/start/complete a task and finish a process instance.

       

      However now it is required that an "automatic task" take some input and save some information in Database and make a complex comparison.

       

      For this reason I´m thinking that a new Service Task with a Web Service Client could make this job.

       

      I´m looking for assistance to achieve this and also to create a guide for business solutions with Web Services.

       

      I was checking the great post of Maciej Swiderski: http://mswiderski.blogspot.de/2012/07/service-task-with-web-service.html 

       

      And I would like to know if the designer is now prepared to provide WebServices definition without the BMP diagram modification.

        • 1. Re: Web Service client in Jbpm 5.4
          swiderski.maciej

          If you already have the service implemented as web service then it makes sense to use the service task and just all it from whitin the process. If you consider implementing the web service from scratch maybe you can consider using domain specific service in jbpm that allows you to encapsulate given logic in process task. See details here

           

          HTH

          • 2. Re: Web Service client in Jbpm 5.4
            aarellano

            Hi Maciej,

             

            Could you explain me a little bit more the first option? ("use the service task and just all it from whitin the proces")

             

            Because I need that my jBPM process calls automatically a WebService that is published in my WebApplication. The problem that I see is how to modify the "Service Task" using the Guvnor Designer in order to define a WSClient or communicate with external systems.

             

            Thanks!


             


            • 3. Re: Web Service client in Jbpm 5.4
              swiderski.maciej

              it should state:

              ".... use the service task and just call if from within the process..."

               

              anyway in 5.4 I am afraid there is not web service task support in web designer so that mean you need to either use newer version or do the changes manually in bpmn2 file (most likely not appealing task). You could try to use this designer branch to build as it should be compatible with 5.4 but with new features. That branch seems to have support for Web Service Service task

               

              HTH

              • 4. Re: Web Service client in Jbpm 5.4
                aarellano

                Thanks Maciej,

                 

                However I´m reading two options that could work for me and maybe you could provide some information:

                 

                1.- Create a new Work Item Definition in Guvnor with the Designer and create a Work Item Handler on my WebApp. And when I start my application link my handler with the item definition. I don´t know if I understand all the implementation details.

                 

                2.- To use the project: jBPM5-Executor-Service but I don´t know if it wich solution provides me a clean solution.

                 

                Thanks!

                • 5. Re: Web Service client in Jbpm 5.4
                  aarellano

                  Hi all,

                   

                  Finally I found a way to solve my problem with my architecture.

                   

                  Steps:

                   

                  - I create in GUVNOR a new WorkItemDefinition in the package where my process is defined. Then the "Service Tasks" Tab is available in the Process Designer. (I could not set an image to the Service Task due some error to find it)

                  - I set in the designer the Service Task where I need it.

                  - In my Web Application I create a class that handles the Service Task and should implements org.drools.runtime.process.WorkItemHandler

                  - In the new class define the action in the executeWorkItem method. To complete the task from here this code is needed:

                   

                  public void executeWorkItem(WorkItem workItem, WorkItemManager workManager) {

                        System.out.println("+++++++++++++ in the SubviewRevisionValidatorHandler ++++++++++++++++");

                        You can define a WebService client as in my case or the logic that you need

                        workManager.completeWorkItem(workItem.getId(), param);

                  }

                   

                  - In my Web Application (that start the process) I set this lines before start a process where the first param is the name that you provide in Guvnor to the service and the second param is the new class in you App:

                   

                       ksession.getWorkItemManager().registerWorkItemHandler("ServiceTaskName", new ServiceTaskItemHandler());