JBI Composite Applications with JavaEE

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.

1. Create an EJB Modulescreen-1

2. Name it as JavaEEEJBModule:

screen-2

3. Right click on the newly created EJB Module and select “New Web Service”

screen-3

 

4. When you click “Finish”, a new webservice with a default “hello” operation will be generated:

screen-45. Right click on “Webservices” node and Click on “Generate and Copy WSDL”.

screen-56. Select the conf folder under EJB.

screen-67. Go to the newly generated WSDL, click on Design tab and add PartnerLink Type as shown below:

screen-78. Select the Port type as JavaEEWS

9. Create a new Composite Application project:

screen-8

 

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:

screen-10

 

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:

screen-11

 

16. Create a new TestCase on composite application project. Select the casaport1, hello port in the wizard:

screen-1317. Run the testcase. The first time the test case is reported as “Failed”. Observe the output. Make sure the output is something like this:

<?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.


 

 

 

 

 

 

This content is restricted to site members. If you are an existing user, please log in. New users may register below.

Existing Users Log In
   
New User Registration
*Required field