8 Replies Latest reply on Sep 26, 2007 4:23 AM by Andy Delaney

    write a web service to invoke a process

    Andy Delaney Newbie

      Hello all

      I'm new to Jboss and JBPM and am evaluating it for my company. I have set some simple processes up and am fairly happy with that but what I would really like to do is have my process called via a web service. I can't see how to write a web service that will invoke the process.

      For clarity the first process I would like to write is related to staff take on. When our HRsystem comes across a certain event (new member of staff contract agreed) I want it to invoke a web service with the required information which will then pass this information to a process and kick off the process.

      I presume that is possible but not sure where to start, could anyone point me in the right direction - perhaps a tutorial is available?

      Many thanks

      Andy Delaney

        • 1. Re: write a web service to invoke a process
          Ronald van Kuijk Master

          Andy,

          jBPM has an api (plain java) and an command interface (e.g. via jms or ejb) if you know how to call java from a webservice it is straight forward (with some transaction things) If you do not know how to call java from a (java?) webservice, please look into that first

          • 2. Re: write a web service to invoke a process
            Andy Delaney Newbie

            Thanks for your reply. Would that be the usual way to run a process as a web service, from what you are saying I could write a web service and deploy that and then nudge tasks along etc from that web service using the API?

            I was looking at Intalio which allows you to create a web service and map the task variables to the web service therefore effectively exposing the process as a web service. Is something similar possible in JBPM or would you have to take the above approach?

            I'm very new to JBPM and BPEL etc so exuse me if I'm missing something obvious (which I feel I am at the moment).

            many thanks

            Andy

            • 3. Re: write a web service to invoke a process
              Ronald van Kuijk Master

              It would indeed be the usual way to expose any api as a webservice. So no mapping etc... A kind of default webservice api like the commands in jBPM. (i'm working on this now and then, but not much to checkin yet)

              If you want some kind of mapping etc... I'd propose to use the esb which is great for mappings/transformations etc.

              • 4. Re: write a web service to invoke a process
                Andy Delaney Newbie

                Thanks for your help Ronald, it's much appreciated.

                Andy

                • 5. Re: write a web service to invoke a process
                  Martin Ehrlich Newbie

                  Hi Andy,

                  just to give you some idea what we did in the same situation.

                  We wrote some Java classes with the basic methods we want to use for our Jbpm processes:

                  - JbpmServiceReturnValue startProcess(User user, String processName, HashMap<String, Object> inParameter)
                  
                  - JbpmServiceReturnValue resumeProcess(User user, String processName, long processID, String calledTransition, HashMap<String, Object> inParameter)
                  
                  - JbpmServiceReturnValue readProcess(User user, String processName, long processID)
                  
                  


                  Where:
                  JbpmServiceReturnValue is a class wich contains data from the process call like:
                  - process ID
                  - if process is suspended: Resumable transitions
                  - Process ErrorCodes and Messages
                  - ... some more ...

                  inParameters are a hash map. Its entries will be inserted in the ContextInstance as process variables.

                  This classes also handle the user authorisation before we even start the process.

                  We exposed this classes as our WebService interface for our Business Process Server. This is easy to use from all our applications.

                  Just to give you an architectural idea.

                  Martin


                  • 6. Re: write a web service to invoke a process
                    Ronald van Kuijk Master

                    correct, this is kind of what I am implementing in general. target release is jbpm 3.3

                    • 7. Re: write a web service to invoke a process
                      Burr Sutter Master

                      This not specifically a web service for command API of jBPM but...
                      the JBoss ESB has implemented core jBPM 3.2.x which means you can expose jBPM APIs (deploy, create/start, signal, update vars) as JBoss ESB Services. JBoss ESB Services can be exposed to the outside world as JMS, FTP, File drop, WS, etc.

                      So for example, you can start a new process instance via an FTP event (e.g a new order arrives on our FTP server), signal the process instance via a WS and update the process vars via a JMS message. At least this is the goal and the code is in place, just requires more feedback from users.


                      Burr

                      • 8. Re: write a web service to invoke a process
                        Andy Delaney Newbie

                        Thanks all for your help this has really helped me to get onto the right track.

                        Andy