An example of integration using SOA

Create a SOA project that will accept order as an input and generate invoice as output.

Step 1: Create a new SOA project and name it as order processing system.


Note: In a SOA project if we want to communicate with an external program (SOA or any other technology) then we have to configure reference component in composite.xml.

Step 2: Create two reference components which represents card validation system and billing system.

  • Prerequisite: Collect card validation system and Billing System concrete WSDLS.
  • Drag and drop web service component in external reference panel. Fill below details in the popup.

Name: CreditCardValidatingReference.

Type: Reference.

    WSDL URL: Click on icon and select CreditCardValidation System concrete WSDL.

Port type: BPEL process.


  • Drag and drop another web service component in external reference panel.
  • Name: BillingSystemReference.
  • Type: Reference.
  •     WSDL URL: Click on icon and select billing System concrete WSDL.
  • Port type: Select from dropdown.
  • Callback port type: Select from dropdown. Click ok.


Note: In SOA project if anyone of the reference component is asynchronous, then the current web service should be asynchronous.

Step 3: Drag and drop BPEL process with asynchronous template.


Step 4: Modify xsd and wsdl message blocks as shown in below input and output structures.

Input structure:

1.
Order details.

  • Card number.
  • Vendor.

2. Customer info.

  • Customer id.
  • Customer name.

3. Order id.

4. Item info.

  • Item name.
  • Item cost.

Output structure:

1 Order response.

  • Order id.
  • Customer id.
  • Card number.
  • Card status.
  • Order status.
  • Total amount.
  • Description.

Note:

Provider service: If we want to request external program. That external program is called as provider service.

Requester service: Looking for services from external program is called as requester service. In current example order processing system is a request service. Card validation system and Billing Systems are providers.

Step 6: Create a wire between BPEL and CreditcardValidationSystem reference, BPEL and BillingSystem Reference.


Step 7: Open BPEL and observe two new reference partner links.


Step 8: Implement required business logic to communicate with card validation system in current project BPEL.

  • Drag and drop a scope activity after receiving. Double click on scope activity General tab.

Name: CreditCardValidationSystem Scope and click ok.


  • Expand scope activity and drag and drop invoke activity inside scope.

    Create a binding/wire between invoke activity and CreditCardValidationSystem reference partner link. Fill below details on the popup.

    Name: user defined for example CVSinvoke.

    Input variable: click on + icon to create invoke input variable, click on local variable icon, and click ok.


    Output variable: same as Input variable.



Note: In BPEL process we can use invoke activity to call external service as a reference partner link. If the reference partner link is a synchronous service then invoke activity will create invoke input, output variables. If the reference partner link is asynchronous call back then invoke activity will create only invoke input variables.

  • Drag and drop assign activity before invoke. Double click on assign activity and copy required date folders between process input variable to invoke output variable. Click ok.



  • Drag and drop assign activity after invoke. Double click on assign activity and copy required date folders between invoke output variable to process output variable. Click ok.

Step 9: Drag and drop switch activity after scope activity and create two condition branches and delete other branch. Use the first branch for invalid credit card business and the second one for valid credit card business logic.

  • Select first condition and fill details as shown below.

    Label: INVALID.


Condition: Click on expression builder icon and double click on card status in output variable add =’INVALID’ in expression.

  • Drag and drop assign activity in invalid switch branch and perform below mapping in BPEL process output variable.

    Order status: Not processed.

    Total amount: 0.

    Description: Please provide proper credit card information.



  • Click on the condition part of second switch branch and fill below details.

    label: valid.

    condition: Click expression builder and add valid like first switch condition.

  • Drag and drop scope activity in valid switch branch click on the scope activity to name it as BillingSystemScope. Design required business logic to communicate with billing system.


  • Drag and drop invoke activity inside scope. Create binding between invoke and BillingSystem reference partner link and fill below details in the popup as shown below.

    Name: User defined for example InvokeBS.

    Input: Click + icon to create invoke input variable and select local variable in the popup. Click ok.


  • Drag and drop transform activity before invoke and copy required data from current BPEL process input variable to Billing system invoke input variable.


  • Drag and drop receive activity after invoke and create binding between receive activity and billing system in popup as mentioned below.

    Name: Receive Billing system response.

    Variable: Click + icon and select local variable. Click ok.



  • Drag and drop assign activity after receive BillinSystemResponse and perform below mapping.

    Copy total amount from BillingSystemResponse variable to process output variable.


    Set order status as completed and description as THANKS FOR SHOPPING WITH US in process output variable.



    Step 10: Drag and drop an assign activity before call back activity and copy order id, customer id, card number from process input variable to process output variable. Click ok.



    Step 11: Deploy and test.

Leave a Reply

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