How to use Pick Activity as Calculator service in BPEL Process

Pick activity is similar to receive activity. Pick activity will be triggered when a partner link invokes it. This can contain more than one OnMessage and OnAlarm activities.

Here we will create XSD and WSDL manually from jDeveloper 12C. Then those will be used in creating calculator service with pick activity (OnMessage).

  1. Create a SOA application with SOA project and select Empty Composite.
  2. Create a XSD. Right click on project -> New -> From Gallery -> General -> XML -> XML SchemaPICK_Activity_Calculator_Service_1
  3. Click on OK button. Enter xsd file name and let the target namespace be default.PICK_Activity_Calculator_Service_2
  4. Now enter the xml code in the source tab. Click here for the sample xsd file. XSD will be like this.PICK_Activity_Calculator_Service_3
  5. Create WSDL using this schema. From Gallery -> Business Tier -> Web Services -> WSDL DocumentPICK_Activity_Calculator_Service_4
  6. WSDL creation window will open. Enter WSDL name and select directory. Here we will create message and port type manually.PICK_Activity_Calculator_Service_5
  7. Click on OK buttonPICK_Activity_Calculator_Service_6
  8. Click on green plus sign in Message tab. Enter message name addInputMsg. Now add part in the input message. To do this keep XSD and WSDL window side by side and drag and drop the calculatorInput element in the input message.PICK_Activity_Calculator_Service_7 PICK_Activity_Calculator_Service_8
  9. Create output messagePICK_Activity_Calculator_Service_9
  10. Right click on output message and select Insert Inside Message -> partPICK_Activity_Calculator_Service_10
  11. Enter part name and select reference valuePICK_Activity_Calculator_Service_11
  12. Two messages will look like below screenshotPICK_Activity_Calculator_Service_12
  13. Create six more messages for calculator service. Check below screenshotPICK_Activity_Calculator_Service_13
  14. Second element will be port type in ort type in WSDL. Click on green plus sign in port types tab and enter port type namePICK_Activity_Calculator_Service_14
  15. Click on OK button and create operation under port type. Right click on port type -> Insert Inside portType -> operationPICK_Activity_Calculator_Service_15
  16. Enter operation name and operation type will be Request Response. Select input and output message. You can add fault also according to your requirement.PICK_Activity_Calculator_Service_16
  17. Addition operation will look like below screenshot under port typePICK_Activity_Calculator_Service_17
  18. Create another three operations (subtraction, multiplication, division)PICK_Activity_Calculator_Service_18
  19. Create a BPEL process in this project. Right click on project -> New -> From Gallery -> SOA Tier -> Service Components ->A� BPEL ProcessPICK_Activity_Calculator_Service_19
  20. Here template type will be Base on a WSDL. Browse the newly created WSDL and select calculatorPortType.PICK_Activity_Calculator_Service_20
  21. Click on OK button. Delete receiveInput, replyOutput activities and drag and drop Pick activity in place of receive activityPICK_Activity_Calculator_Service_21
  22. Edit the pick activity. Double click on pick icon PICK_Activity_Calculator_Service_22A�and change the default name. Select Create Instance checkbox also.PICK_Activity_Calculator_Service_23
  23. Double click OnMessage icon and editor of OnMessage operation will open. Select BPEL process partner link and select addition operation. Create a variable for OnMessage operation.PICK_Activity_Calculator_Service_24
  24. Drag and drop a Reply activity under OnMessage.PICK_Activity_Calculator_Service_25
  25. Double click on reply activity to open the editor window. Enter reply activity name and port type & operation will be selected automatically. Create a variable for reply activity.PICK_Activity_Calculator_Service_26
  26. Add an Assign activity before reply activity, under OnMessage scopePICK_Activity_Calculator_Service_27
  27. Map the reply variable with the OnMessage variable through an expressionPICK_Activity_Calculator_Service_28 PICK_Activity_Calculator_Service_29
  28. OnMessage will be like thisPICK_Activity_Calculator_Service_30
  29. Add three more OnMessage operation for subtraction, multiplication and division like additionPICK_Activity_Calculator_Service_31
  30. Save the application and deploy it in weblogic server. Test this application in EM console. Enter two input numbers and select operation of your choice. Here I am selecting addition operationPICK_Activity_Calculator_Service_32
  31. Click on Test Web Service and check the flow instance in Launch Flow TracePICK_Activity_Calculator_Service_33

Test this application with other operations also.

Leave a Reply

Your email address will not be published. Required fields are marked *

Show my latest post here