Implement Parallel Split Join OSB

Example for implementing parallel Split Join in Oracle Service Bus (OSB) 11g:

Consider the following is the scenario:
We have a Customer Inquiry Service, which takes Cust_ID, Cust_name and Brand as an Input and return Cust_ID, Cust_name and Balance as an output.

You will receive a customer list as an Input, here instead of calling "Customer Inquiry Service" sequential, 
We can use Parallel Split Join In OSB to make the parallel call to "Customer Inquiry Service".

The response from all the requests will be aggregated and return back to the client.

Following are the steps:

I created a simple XSD that will take list of customer request and return the list of response.
Request Xsd
Created a simple WSDL based on the request and response element mentioned above





Created a Dummy  "Customer Inquiry Service" proxy service (Customer.proxy) that will return a sample response. Base the proxy service on the WSDL created above. Will call this proxy service parallel. Have purposely used proxy service to demonstrate that split join can be used to call both business and proxy service.  
Sample Response:
<tns:Rs xmlns:tns="http://www.example.org/OrderRq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.example.org/OrderRq Customer.xsd ">
  <tns:OrderRes>
    <tns:CustID>101010</tns:CustID>
    <tns:CustName>John</tns:CustName>
    <tns:Bal>1000</tns:Bal>
  </tns:OrderRes>
</tns:Rs>
Now create a new SplitJoin based on the WSDL created above.























You will find the request and response element variable in split join




















Insert the assign action below Receive to initialize the response variable
Eg.
<tns:Rs xmlns:tns="http://www.example.org/OrderRq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.example.org/OrderRq Customer.xsd ">
</tns:Rs>
Insert the For Loop, Set the parameter as mention below:-
Parallel : Yes
Name Counter variable: counter
Start Counter: Say Starts with 1 (number(1))
Final Counter: Number Customer in Request count($request.parameters/ord:orderRq)











Create two for loop variables, in this case its Cust_Rq, Cust_Rs

























Now Insert Copy Action to get each customer element from the request and put it in one Variable (Cust_Rq).  Which we will assign as a input of the invoke service.




















Next, Insert the Invoke Action to call the "Customer Inquiry Service" proxt service.
1. Select the Operation mention in the wsdl.
2. Set Input Variable as Cust_Rq
3. Set Response Variable as Cust_Rs
Refer the below screen shot for the same:















This for loop make a multiple calls to the external service and assign the response to Cust_Rs response variable created. Now we have to Insert the contents of Cust_Rs to main Response variable, so that we can aggregate the responses.
Below are the steps for the same.
Add the Insert action after Invoke. 







Now our split Join is ready. Split Join is called from Business service. So let create a Business service now.
Right Click spilt join and click generate business service.




















Now you can call this business service from any proxy and use split join.
Sample test Request:
<ord:Rq xmlns:ord="http://www.example.org/OrderRq">
    <ord:orderRq>
        <ord:CustID>101</ord:CustID>
        <ord:CustName>John</ord:CustName>
        <ord:Brand>Bank</ord:Brand>
    </ord:orderRq>
<ord:orderRq>
        <ord:CustID>102</ord:CustID>
        <ord:CustName>Sam</ord:CustName>
        <ord:Brand>Bank</ord:Brand>
    </ord:orderRq>
</ord:Rq>
Sample Response:
<tns:Rs  xsi:schemaLocation="http://www.example.org/OrderRq Customer.xsd " xmlns:tns="http://www.example.org/OrderRq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<tns:OrderRes>
<tns:CustID>101010</tns:CustID>
<tns:CustName>John</tns:CustName>
<tns:Bal>1000</tns:Bal>
</tns:OrderRes>
<tns:OrderRes>
<tns:CustID>101010</tns:CustID>
<tns:CustName>John</tnsCustName>
<tns:Bal>1000</tns:Bal>
</tns:OrderRes>
</tns:Rs>
Do let me know If you find some problem, Thanks

-Rohan Lopes

Popular posts from this blog

JAVA embedding in Oracle SOA 12c

Passing/Receiving HTTP header in SOA BPEL

Integrating Weblogic with IBM MQ over JMS