Monday, January 20, 2020

12c SOA - BPEL pick activity OnMessage

"This activity waits for the occurrence of one event in a set of events and performs the
activity associated with that event. The occurrence of events is often mutually
exclusive (the process either receives an acceptance or rejection message, but not both).
If multiple events occur, the selection of the activity to perform depends on which
event occurred first. If the events occur nearly simultaneously, there is a race and the
choice of activity to be performed is dependent on both timing and implementation."

The two branches of the pick activity are as follows:
OnMessage:
  • Automatically displays below the Pick activity icon.
  • Contains the code for receiving a reply, for example, from a loan service.
OnAlarm:
  • Does not automatically display; you must manually add this branch by selecting the Pick activity icon and clicking the Add OnAlarm icon.
  • Contains the code for a timeout, for example, after one minute.
OnMessgae with implementation:

Topics covered:

1. Developing a BPEL process which can expose multiple operations to its clients or handle multiple messages request from clients

2. Developing the BPEL process in Top – Down approach

3. Having a pick activity as the first activity in BPEL process

4. Developing a BPEL process Based on WSDL

5. Developing XSD and WSDL from the created XSD.

Sample Description:

Implementing the Calculator service which exposes 4 operations( addition, subtraction, multiplication, division) which takes 2 parameters as input and returns value. Use BPEL to implement the Calculator service and expose it as service so that client can any operations of his choice.

Create a SOA Project with empty composite


Creating XSD
Right click the PickProject –> New –> In “New Gallery” window select “All Technologies” Tab –> In “General” Section select XML –> Select “XML Schema” –> click OK



 XSD used:
<?xml version="1.0" encoding="windows-1252" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.cal.org" targetNamespace="http://www.cal.org"
            elementFormDefault="qualified">
    <xsd:element name="calculatorInput">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="inputParam1" type="xsd:int"/>
                <xsd:element name="inputParam2" type="xsd:int"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="calculatorOutput">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="output" type="xsd:int"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
</xsd:schema>

Develop a WSDL with 4 operations (addition, subtraction, multiplication, division)

Right click PickProject –> New –> All Technologies –> Web services –> WSDL Document –> OK


 Create a Messages by clicking “+” in message section
 Enter the Message Name –> Click OK
 Create a part element inside the “addInputMsg”.
– Simple way of doing this by dragging and dropping the “CalculatorInput” element from Calculator.xsd on the “addInputMsg”.

– To do this keep “Calculator.xsd” and “Calculator.wsdl” in 2 different window side-by-side as below

 Know drag and drop the “CalculatorInput” element from XSD on to “addInputMsg” of the wsdl
 Create one more message element for addition response by clicking “+” symbol
 create the part by right clicking on “addOutputMsg” element.Specify the Part Name and Reference Value
 creating the other message required for remaining operations

Create a “PortTypes” by clicking “+” in PortTypes section





 Similarly create other operations(Subtraction, Multiplication, division)
 Create a BPEL Process based on WSDL


 By default when the process is created it will create the Receive, Reply activity based on the operation type in wsdl.
Delete the default activities created as part of the process like receive, reply
Drag and drop the pick activity on to the Calculator process
Double click the pick activity and Specify the name and Select “Create Instance” checkbox





 Double click the OnMessage –> Select Partner Link, Operation, variable to hold the data.
Drag and drop the Reply activity on to the OnMessage. Know connect the reply activity with the Partner link.
Drag and drop the assign activity before the reply activity to assign the result value to the reply output variable.
Add 3 more OnMessage activities as part of the Pick activity
Repeat the above steps for other OnMessage activities with other operations






Deploy and test


No comments:

Post a Comment

Featured Post

11g to 12c OSB projects migration points

1. Export 11g OSB code and import in 12c Jdeveloper. Steps to import OSB project in Jdeveloper:   File⇾Import⇾Service Bus Resources⇾ Se...