In this example, I will show you how to call an asynchronous BPEL process from another BPEL process. Here I will call asynchronous BPEL process created in previous example. Copy the URL of WSDL of the previously created BPEL service and we will use it in this example for invoking that service. Follow the below steps to implement this.
- Create a SOA project same like previous article and select Composite With BPEL Process option in the next wizard.
- Click on FINISH button and BPEL process creation wizard will open. Enter BPEL process name and select Asynchronous BPEL Process as template type
- Click on OK button and BPEL process will open like below screenshot
- Select PARTNER LINK from Web Service Component and drag and drop it into the right swim lane
- Enter Partner link name and paste the URL of WSDL that was copied from the previous example
- Select INVOKE activity from component palate and drag and drop it after receiveInput
- Drag a wire from Invoke activity to Partner link and editor wizard of invoke activity will open. Create an input variable of invoke activity by clicking on green plus icon.
- Select RECEIVE activity from Web Service Component and drag and drop it after the invoke activity
- Double click on Receive activity to open the editor wizard of receive activity. Enter receive activity name and create a variable. Select AsyncPartnerLink as Partner Link and select Create Instance checkbox
- Now BPEL process will look like below screenshot
- Drag and drop an ASSIGN activity before invoke activity and do the mapping between input payload and input variable of invoke activity
- Drag and drop one moreA�ASSIGN activity after receive activity and do the mapping between input variable of receive activity and output variable
- Save the whole project and deploy the project in Integrated Web logic Server
- Test the project in EM console and check the flow by clicking on Launch Flow Trace
- Check the flow of both BPEL Services. Click on AsyncBPELProcess and you will see that the process is waiting for the completion of wait activity.
- Click on AsyncBPEL process. As the calling BPEL process is not completed, the receive activity is still pending to receive the outcome of the calling service.
Check the instance flow after 30 seconds again. All the process will be completed as expected.