This procedure provides general instructions for calling a business process from a POJO service. You can view a tutorial with more detailed information for completing this process at http://wiki.open-esb.java.net/Wiki.jsp?page=POJOJBISamplePOJO2BPEL.
This task requires that the business process being called is already created. For information on creating a business process, see BPEL Designer and Service Engine User’s Guide.
Create the business process with any necessary activities and WSDL documents.
For more information about creating business processes, see the BPEL Designer and Service Engine User’s Guide.
Create a new Java Application project for a POJO consumer, as described under Creating a POJO Service Consumer (Without Binding) or Creating a POJO Service Consumer (With Binding).
Standard code is automatically generated for the consumer.
Modify the code between the Consumer Invoke comments to handle the input from the business process.
Below is a simple example of adding a response string to the message received from the business process.
@Operation (outMessageTypeQN="{http://jseecho/Echo/}EchoOperationResponse") public String receive(String input) { /* Consumer Invoke - Begin */ { String inputMessage = null; try { String outputMsg = (String) sepEchoInterfaceEchoOperation. sendSynchInOut(inputMessage, org.glassfish.openesb.pojose. api.Consumer.MessageObjectType.String); return "Hello from POJO: " + outputMsg; } catch (Exception ex) { ex.printStackTrace(); } } /* Consumer Invoke - End */ return "Hello from POJO: " + input; } // Logger private static final Logger logger = Logger.getLogger(Echo.class.getName()); // POJO Context @Resource private Context jbiCtx; @ConsumerEndpoint(serviceQN = "{http://jseecho/Echo/}epEchoInterfaceEchoOperatioService", interfaceQN = "{http://jseecho/Echo/}EchoInterface", name = "epEchoInterfaceEchoOperatio", operationQN = "{http://jseecho/Echo/}EchoOperation", inMessageTypeQN = "{http://jseecho/Echo/}EchoOperationRequest") private Consumer sepEchoInterfaceEchoOperation; |
When you are done modifying the code, click Save on the NetBeans toolbar.
Right-click in the Projects window, and then select New Project.
The New Project Wizard appears.
Under Categories, select SOA; under Projects, select Composite Application.
Click Next.
The Name and Location window appears.
Enter a name for the Composite Application and modify the location of the project files if necessary.
Click Finish.
The new Composite Application appears in the CASA Editor.
Drag the POJO Service Engine project from the Projects window to the JBI Modules section of the CASA Editor.
Drag the BPEL project from the Projects window to the JBI Modules section of the CASA Editor.
In the CASA Editor toolbar, click Build Project.
The business process, POJO service, endpoints, ports, and connections appear in the CASA Editor.
To deploy the application, do the following: