1 Reply Latest reply on Apr 7, 2012 11:20 AM by nujib

    How to trigger an external signal event with a web service

    nujib

      Hello,

       

      I am really new to Java and Jbpm so my questions may sound stupid. I designed a simple Process which looks like this :

       

      see attached file.

       

      and what I'd like to do is to trigger the signal event using a web service. I have a main function initializing the knowledgeBase and starting my process just like the HelloWorld example. I just moved the initialiation step to another class called ProcessManager which holds a static ksession variable. Here is the aborescence of my project :

       

      see attached file.

       

      My configuration is the following :

       

           -     jBPM 5.2

           -     Eclipse Helios SR2 3.6.2

           -     Tomcat 6 with Axis 2

       

      I already manage to create a webservice and integrate it into tomcat so that I can use SoapUI to make a call a get the result in the eclipse console.

      I tried to trigger the signal event by inserting the following piece of code into the exposed method of my WS :

       

      ProcessManager.ksession.signalEvent("receptionRetourOperat", 1);
      

       

      The problem is that the ksession that is initialized in my main function is null when making the WS call. I guess the two executions (WS call and main) are done in a different context so that I can't get the initialized ksession variable from my WS call. My questions are the following :

       

      - Is it possible to make the WS access the ksession variable from the main function ?

      - Does it make sense to have only one jBPM session and to create a process instance at each WS call ?

       

      Thanks.

       

      Ce message a été modifié par: Francois MARTIN

        • 1. Re: How to trigger an external signal event with a web service
          nujib

          Hello,

          In case someone is interested, I found out how to solve my problem.

          The solution was to create a web dynamic project in eclipse and to initialize the knowledge base in a servlet. Then I created a web service in this project and sent the external event in the exposed method. I exported my project as a .war file using eclipse and put it into the webapps folder of my Tomcat installation.

          I'm not sure that this architecture is pertinent and it would be interesting to discuss but at least it works.