Most of the JBI composite applications in OpenESB are written using BPEL Service Engine. This is because BPEL allows us to orchestrate various webservices. But what if one wanted to write a simple composite application without using BPEL. Let’s say someone wants to use an EJB WS as part of a larger composite application without invoking as an external webservice. By using Java EE Service Engine we will be bypassing the http layer. The JavaEE SE takes care of invoking EJB webservice from within a composite application.
This blog is about creating a composite application only using Java EE SE. We will create an EJB WS and include it in a composite application.
2. Name it as JavaEEEJBModule:
3. Right click on the newly created EJB Module and select “New Web Service”
4. When you click “Finish”, a new webservice with a default “hello” operation will be generated:
9. Create a new Composite Application project:
10. Name it as JavaEEEJBCA.
11. Open the CASA editor by double clicking on “Service Assembly” under the composite application project
12. Drag the EJB Module into CASA Editor. It should look like this:
13. Right click on the composite application project and select “Clean and Build”.
14. After build succeeds, drag the soap icon from “WSDL Bindings” tab from Palette to WSDL Ports section of CASA editor.
15. Join the inbound port from SOAP Binding to Java EE Port. Your casa now should look like this:
16. Create a new TestCase on composite application project. Select the casaport1, hello port in the wizard:
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/ http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Body> <ns2:helloResponse xmlns:ns2="http://test.logicoy.com/"> <return>Hello ?string? !</return> </ns2:helloResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
Right click on the output and set it as expected output. Then run again. Observe the test result passes.