27.08.2010

Websphere Integration Developer 7 – Invoking EJB Modules

1. Create an EJB Project
EJBProject 
Click Next, and then fill the fields with the texts  below written in italic.
Project Name : CoffeeShopEJB
Target Runtime : Websphere Process Server 7.0
EJB Module Version : 2.1
EAR Project Name : CoffeeShopEJBApp

2.
Create an Stateless EJB
 CreateEJB

ejbProps
3. Open CoffeePricePredictorBean.java and then add this method below

public double predictPrice(String coffeeType)
{
System.out.println("*************EJB Mehtod is invoked****************");
System.out.println("ejb.samples.coffee.CoffePricePredictorBean.predictPrice");
return 5d;
}







4. From the outline panel click predictPrice method and click promote to remote interface option


promoteToRemote 
Ok then if you follow these 5 steps you have a working EJB Module. After these steps you will find how to invoke these methods from a process/





5.Create a simple module with following the steps in HelloWorldProcess post but the module name in my sample is CoffeeEJBInvoker.





6.  Create the process interface



ProcessInterface 
ProcessInterfaceProps


7. Create the CoffeePricePredictorProcess as a micro-flow process


CreateProcess


AssignProcessInterface


8. Design your process







processDesign


9. Add the process interface CoffeePricePredictorProcess as a ReferencePartner. What you have to do is just drag and drop CoffeePricePredictorProcess  to the process design panel.


referencePartner


10. From the Details tab of InvokeCoffeePricePredictorService fill the fields like the picture below.


 InvokeCoffeePricePredictorServiceDetails


11. From the project dependencies section add EJBClient as java library


ProjectDependncies


12. Open Assembly Diagram Panel and drag and drop CoffeePricePredictorProcess into the panel.





13. Drag and Drop Enterprice JavaBeans component into AssemblyDiagram panel to JavaBeans component. Select the interface below.



ejbInterfaceImport


14 . Link the process component to Enterprice JavaBeans component. WID will ask the mediation module. Since i do not add java component to invoke EJB, WID creates a mediation for invocation.


SimpleMediation


15. Double click mediation which is in the middle.


Click predictPrice and select ServiceIntegration


ServiceIntegration


16. Add reference operation





referenceOperationjpg


17. For the request operation link CoffeePricePredictorProcess to partner1. Since this operation needs transformation choose XSLT transformation.


requestOperation


xstlTransformation


18 Double clik XSLTTranformation1


DoubleClickXSLTTrans


19. Map the fields


mapFields



20. So up to know we made the process invoke ejb module in terms of mediation we designed request operation . But this operation is request and response operation we need to implement response operation.

Click response tab.


responsejpg 
21. Link partner1 component to CoffeePricePredictorProcess





responseLink


22. Choose XSLT Transformation


23. Double click XSLST Transformation1 component


24.Map appropriate fields


responseTransformation


25. Process design section is finished. So we can test our process.


TestModule 
26.


Expresso


27. The Test result


TestResultjpg

Hiç yorum yok: