Echo Service - POJO calling BPEL process
In this tutorial we will develop simple POJO service/endpoint which invokes BPEL process synchronously. This tutorial will show
what annotations are used in order for POJO to consume a service/JBI Endpoint.
We will create a Composite Application so that Http SOAP BC will be used to invoke POJO service, which in turn synchronously
invokes BPEL process. We will also use Composite Application project's tester to test our endpoint.
Since originally written, some of the API classes have changed, but in most part this sample/tutorial should work. You can find more details of API changes
here and
here.
Either use installer which comes with the all the components or download and install POJO SE Engine and Netbeans modules individually.
Create a BPEL project.
Create a new BPEL project.
Create a simple WSDL to be implemented by BPEL process.
Create a BPEL process, implement above WSDL.
Create mapping of input message to output.
Create Java SE Application Project
Create a Java SE application project.
Create a POJO endpoint.
Consume a JBI endpoint, drag and drop "POJO Consumer" palette icon into the method.
Palette action dialog allows you to directly enter Interface QName which is same as WSDL PortType name. Since most of the
JBI components need WSDL Operation QName and WSDL operation input message type, you may enter it here, so that it will
be populated into appropriate annotation. Or you can select WSDL from file system or URL, dialog will read the WSDL
and populate all the values needed for you.
Note stub code is "sendSynch" code is created for you. Also instance member for POJOContext and ServiceEndpoint created for you.
These objects will be injected during runtime before operation method is invoked by POJO SE.
You may want to tweak the generated code as below.
String inputMessage = input;
try {
String outputMsg = (String) ctx.sendSynchInOut(sep1, inputMessage, POJOContext.MessageObjectType.String);
return "Hello from POJO: " + outputMsg;
} catch (Exception ex) {
ex.printStackTrace();
}
return "Hello from POJO: " + input;
Create Composite Application Project
Create Composite Application project.
Drag and drop BPEL and Java SE application project into the CASA editor.
Clean and build the composite application project. Notice the connections. Create a "soap" port to linked to POJO SE endpoint,
so that it will allow us to trigger POJO endpoint from HTTP SOAP BC.
Make sure composite application project "clean and build"s correctly and POJO Service Engine is installed and running
in Glassfish server.
Create a test in composite application project using Http SOAP BC port/WSDL created in composite application project. Run the test,
notice the output confirming the call being made to BPEL process via POJO Service Engine.
Return to the top
Return to POJO SE Page
Return to POJO SE tutorials Page