Friday, 30 May 2014

Asynchronous BPEL Process Returning Multiple Responses

There are certain scenarios in which an Asynchronous process can have multiple responses.

Lets assume an asynchronous process which accepts input parameters: firstName ,lastName and operations.
If operation is "name" it returns only First Name
If operation is "fullname" it returns  firstName and lastName.

As the returned values in both the cases are different number of items we need to use two different operations.

Create a new composite AsynchNameDemo and select composite with BPEL Process and click on Finish button.



















































Give the process name as BPELProcess and choose template as Asynchronous BPEL Process.























Open BPELProcess.xsd and edit it for appropriate request and response parameters.



























Open BPELProcess.wsdl file to add the appropriate changes.

  • Add a new meesage based on new response element processResponseFullName















  • Add a new operation in the callback porttype.











Now open BPEL process and add a switch activity.In the case branch add the condition that if operation='name' we will return only first name.
















Drag and bring the callbakClient inside case branch.Open the callbackClient and make assure that operation selected is processResponse. 

















Add as assign activity before this invoke and assign output parameter the first name as output.






















Delete the otherwise branch of switch activity and add one for condition branch and add the condition for operation as :"fullname".













Add a invoke activity in this case branch and name it as callbackClientwithFullName. Choose the operation type as processFullNameResponse and add an auto created input variable.






















Add an assign activity before this invoke activity and assign appropriate output variables for operation type "fullname".






















The complete process now looks like:-


























Now deploy the process and test.
  • When input is "name"



















  • When operation is "fullname"





















No comments:

Post a Comment