6 Replies Latest reply on May 9, 2011 11:17 AM by jeffdelong

    Invoke java from within BPEL module


      We have a JBOSS 5.1.0 server that has Riftsaw 2.1.0.CR2 with Apache ODE.  I need to run a  BPEL 2.0 process on that server which calls a java class instead of a web service. I have not seen anything in the BPEL Desinger that allows me to do that. I know I can expose the java class as a web service, but I was told not to go that route.  Does anybody have any suggestions?

        • 1. Re: Invoke java from within BPEL module

          Invoking a Java class from a BPEL process is not a feature of the BPEL 2.0 specification. BPEL is a standard for Web services orchestration and Riftsaw does not provide such a capability to invoke Java classes directly. If it did, it would be non-standard, and your process definition would not be portable to other BPEL product implementation.


          I am not sure why you were told not to expose the Java class as a Web service, since this is pretty easy to do using JSR-181 annotations. JBoss Tools and JBoss Application Server support this capability very nicely.


          On the other hand, if all of your services are Java classes, perhaps BPEL is not the right orchestration language.

          • 2. Re: Invoke java from within BPEL module

            Thanks Jeff...I did have one other possible option I wanted to get your opinion on, and that was using Apache WSIF which gives you a WSDL with a java binding.  I am assuming I could then create a BPEL partner link using that WSDL.   Have you had any experience with this, and if so, do you still think I should just expose the java class as a web service instead.

            • 3. Re: Invoke java from within BPEL module

              I don't think this would actually work, as the client in this case is RIftsaw. I don't think Riftsaw would be able to consume a WSDL with a Java binding, as this requires the client to consume the service through instantiation of and invoking methods on a Java class.


              So I still think your best bet is to expose your Java class using JSR-181 annotations. Let me know if you need some advice on how to do this, and I can show you a simple example.

              • 4. Re: Invoke java from within BPEL module

                Thanks Jeff...I do not need an example.  I was able to do as you specified and use the web service annotations in my java class.  I appreciate all your help!

                • 5. Invoke java from within BPEL module

                  Hi Jeff,


                  Could you please provide me an example of how are there annotations used?


                  Thank you,


                  • 6. Re: Invoke java from within BPEL module

                    Here is a code snippet.



                    * Session Bean implementation class PolicyQuoteEntityWS



                    @SOAPBinding(style = Style.DOCUMENT, use = Use.LITERAL, parameterStyle = ParameterStyle.WRAPPED)


                    public class PolicyQuoteEntityWS implements PolicyQuoteEntityWSLocal {



                              EntityManager entityManager;


                              public PolicyQuoteEntityWS() {





                              @WebResult(name = "policyQuote")


                              public PolicyQuote createPolicyQuote(

                                                  @WebParam(name = "policyQuote") PolicyQuote policyQuote) {




                                        return policyQuote;



                    I have attached the entire example of a stateless session bean that is exposes as a web service. This SLSB uses JPA. Youo ca nimport the project into your Eclipse / JBoss Tools IDE.