10 Replies Latest reply on May 19, 2008 1:55 PM by jagr

    Invoking webservice from action

    jagr

      How can I configure jbpm to action invoke a webservice?

      I want to action in my process, invoke a webservice thats it's on other machine. I've only a wsdl.

      I've worked with webservices with axis2 and I 've created clients, but in jbpm I don't know how can I do this.

      Somebody can tell me a tutorial or example?

      Thanks

        • 1. Re: Invoking webservice from action
          salaboy21

          I think this is a very easy task..
          you only need to use/call your generated clients inside the action code...

          for example:

          public class MyActionHandler implements ActionHandler{
           public void execute(){
           WebServiceCliente.webServiceMethod();
           }
          }
          


          Sounds to me that i don't understand your question.. let me know..

          • 2. Re: Invoking webservice from action
            kukeltje

            Salaboy is correct. That would have been my answer to.

            • 3. Re: Invoking webservice from action
              jagr

              Ok. That it's correct, but how can I call this webservice client if my websercive client it's on another project out of jbpm project.
              Should I import entire webserviceclient project into jbpm project?
              I'm using eclipse 3.0.3, jbpm 3.2.2 and webservice client it's generated with axis2 and it's project standalone.
              Maybe there are easy way to create webservice client into jbpm project?

              I'm confused

              Thanks

              • 4. Re: Invoking webservice from action
                kukeltje

                 

                but how can I call this webservice client if my websercive client it's on another project out of jbpm project.
                how would you normally invoke remote services? via ejb's? webservices? rest? Again, nothing different than normal java

                • 5. Re: Invoking webservice from action
                  salaboy21

                  Yeah! get your hands dirty! I suggest to 3 steps

                  If you have 2 projects then do this...
                  Generate the client and test it ..
                  then copy the client class into the jbpm project (add all needed libraries and refactor the packages names if needed)
                  Then call the web services inside an ActionHandler exactly in the same way that you do it on the test..

                  Hope it helps

                  • 6. Re: Invoking webservice from action
                    jagr

                    Ok.
                    My problem was solved.
                    I generated .class webservice client with jax-ws and I tested it in a simple java project.
                    I've included .class into .class folder in jbpm project and I use clases into action.
                    Works fine.
                    thanks salaboy and kukeltje

                    • 7. Re: Invoking webservice from action
                      salaboy21

                      thats sounds good .. but you must include the source code in your second project.. or make a jar with all .class files that you need and the include it in the bpm project...!

                      • 8. Re: Invoking webservice from action
                        jagr

                        Why sometimes when I execute process and enter in node that invoke webservice Exception is thrown because don't find the class?

                        ava.lang.NoClassDefFoundError: com/aixtelecom/portbooker/UpdatePrice_Service
                         at com.aixtelecom.portbooker.bpm.actions.Node1Action.execute(Node1Action.java:32)
                         at org.jbpm.graph.def.Action.execute(Action.java:122)
                         at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:264)
                         at org.jbpm.graph.def.GraphElement.executeActions(GraphElement.java:220)
                         at org.jbpm.graph.def.GraphElement.fireAndPropagateEvent(GraphElement.java:190)
                         at org.jbpm.graph.def.GraphElement.fireEvent(GraphElement.java:174)
                         at org.jbpm.graph.def.Node.enter(Node.java:303)
                         at org.jbpm.graph.def.Node$$FastClassByCGLIB$$d187eeda.invoke(<generated>)
                         at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
                         at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:163)
                         at org.jbpm.graph.def.Node$$EnhancerByCGLIB$$ef5f66fa.enter(<generated>)
                         at org.jbpm.graph.def.Transition.take(Transition.java:151)
                         at org.jbpm.graph.def.Node.leave(Node.java:394)
                         at org.jbpm.graph.node.StartState.leave(StartState.java:70)


                        Jax-ws only generate .class from webservice.
                        I add these .class into folder and in eclipse I specify in build path project, Add class folder and I select folder that contains .class generated.
                        Into action of jbpm, I can use this generated classes and invoke web service, but now, when I execute the process and enter into node that invoke ws, exception java.lang.NoClassDefFoundError is thrown but I don't know why.

                        • 9. Re: Invoking webservice from action
                          salaboy21

                          like i said before..
                          add the source classes and then compile it all together...
                          make sure that you can import the classes in your action handler...
                          Hope it helps

                          • 10. Re: Invoking webservice from action
                            jagr

                            The problem is that jax-ws only generate .class :/ but if I create a simple java project with main class and execute as java aplication runs ok but in jbpm thrown the exception NoClassDefFoundError