The synchronous process defines one two-way operation port to receive the request and send the response back. Using the invoke activity, client invokes Synchronous BPEL process on this port and waits to receive response on the same port. As soon as the client receives response from BPEL process it continues with its flow. On the BPEL process side, the Synchronous BPEL process gets instantiated on receiving the client request and sends back the reply using the reply activity on the same port on which the Client is waiting.
Create a new project to validate credit card information input. If credit card number is greater than 5000 it is valid, else it is invalid.
Input structure:
-
Credit card request
-
Order Id
-
Customer Id
-
Credit card Number
-
Output structure:
-
Credit card Response
-
Order Id
-
Customer Id
-
Credit card Status
-
Create new SOA project as Card validation system. Open Composite.xml file drag and drop BPEL process into components.
In popup select BPEL 1.1 specification and follow below instructions.
Name: User defined.
Namespace: User defined keyword as target namespace of BPEL.
Template: Synchronous BPEL process.
Service name: User Defined keyword.
Click ok.
Open xsd document and modify as per requirement in source view.
After modifying xsd open WSDL file and modify as per requirement.
Double click on BPEL in composite.xml
Add switch activity after receive activity from BPEL constructs.
Click on condition and add some information as follows.
Label: As user defined. For example, “Valid Credit Card”
Condition: Click on expression builder icon and create expression. Double click on credit card number int on input variable. add >=5000 in expression like below image.
Drag & Drop Assign activity in ValidCreditCard Condition.
Double click on assign activity. click on expression builder in assign activity.
Wright VALID in capital letters with Quotation marks as in below image in expressions tab.
After drag, a line to the creditcardstatus string in right side output variable.
Create a new condition in the switch activity by using instruction in the below image.
After adding another condition click on the condition and follow below steps.
Label: As user defined. For example, “Invalid Credit Card”
Drag and drop assign activity in second condition and double click on it. After click on expression builder.
Wright INVALID in capital letters with Quotation marks as in below image in expressions tab.
After drag, a line to the creditcardstatus string in right side output variable.
Drag and drop assign activity after receive input as shows in the below image.
Copy order id and customer id from process input variable to process output variable as shows in the below images.
Deploy and test the SOA project.