Getting Started with Oracle SOA BASIC CONCEPT OF ORACLE SOA Lab#13
Description: BISP is committed to provide BEST learning material to the beginners and advance learners. In the same series, we have prepared a complete end-to end Hands-on Beginners Guide for Oracle SOA. The document focuses on Flow and FlowN activities. Join our professional training program and learn from experts.
History: Version 0.1 0.1
Description Change Initial Draft Review#1
Author Shiva Kant Pandey Amit Sharma
Publish Date 21th Aug 2012 29th Aug 2012
[1] Business Intelligence Solution Providers
Contents
Parallel Processing by using FlowN activity ............................................................................................................................ 3 Flow Activity ................................................................................................................................................................ 3 FlowN Activity ............................................................................................................................................................. 3
Stepwise Procedure of Project FlowNProcess by using FlowN activity .................................................................................. 4
[2] Business Intelligence Solution Providers
Parallel Processing by using FlowN activity
A BPEL process service component must sometimes gather information from multiple asynchronous sources. Because each callback can take an undefined amount of time , it may take too long to call each service one at a time. By breaking the calls into a parallel flow, a BPEL process service component can invoke multiple web services at the same time, and receive the responses as they come in. This method is much more time efficient. So there are two Parallel Process Activities these are : Flow Activity: The Flow activity is used to configure parallel activity in BPEL processes. In theory, activities contained in two or more branches (sequence containers) inside a Flow activity are executed in parallel. FlowN Activity: The flowN activity creates multiple flows equal to the value of N, which is defined at runtime based on the data available and logic within the process. An index variable increments each time a new branch is created, until the index variable reaches the value of N. Simply we can say if we know number of operations to be processed in parallel then we can easily predict the number of flows in Flow activity but if we don't have previous information of number of operations & so can't predict the count of flow so for this reason we need FlowN activity & hence we simply assume number of operations is N & an index which is assigned equal to 1 & hence it ask for N number of flows to process in parallel . NOTE: The FlowN activity creates multiple flows equal to the value of N , which is defined at runtime.
[3] Business Intelligence Solution Providers
Stepwise Procedure of Project FlowNProcess by using FlowN activity
Step 1: Create new project New --->All Technologies--->SOA Tier --->SOA project --->OK ---> Project Name (FlowNProcess) ---> ADF Business Component---> SOA--->Next
Step 2: Click Composite with BPEL Process
Step 3: Click Finish
Step 4: Fill all its blank spaces [4] Business Intelligence Solution Providers
Name (FlowNProcess) ---->NameSpace (Leave as it is)--->Template(Select Synchronous BPEL Process)---> Service Name(FlowNService)----> mark Expose as a SOAP service --->Click Ok
Step 5: Open Composite.xml & observe BPEL Process
Step 6: Click on ParallelProcess.xsd & it is automatically generated xsd for sync bpel process. [5] Business Intelligence Solution Providers
Rename Input Element as ProcessNumber & then add sequence ----> then sub elements i.e element1 and Element2 now rename Element1 as NumberA & element2 as NumberB as shown in next figure.
Step 7: Open property inspector & then click on ProcessNumber , now see propery inspector & give minOccurs = 1 & maxOccurs = unbounded then click enter now see xsd in design mode that processNumber is bounded from 1 to infinite .
Step 8: Click on Schema targetNamespace & Element
Create an additional Element & a Complex Type
Step 9: Rename complex type as ProcessNumberResultType & right click on it then select sequence [6] Business Intelligence Solution Providers
after sequence create six elements & rename them one by one as numberA ,NumberB, Addition, Subtraction , Multiplication , division respectively .
Step 10: Click on element1 & rename it as ProcessNumberResult
[7] Business Intelligence Solution Providers
Step 11: Register Namespace with Prefix fobj xmlns:fobj="http://xmlns.oracle.com/SOAApps/FlowNProcess/FlowNProcess"
Step 12: Click on ProcessNumberResult and set type as fobj:ProcessNumberResultType & then hit enter & then expand it by clicking on + sign
[8] Business Intelligence Solution Providers
Step 13:Right click on sub element "result" of processResponse & then click Toggle Reference ---> rename result as fobj:ProcessNumberResult. Now we have successfully referenced ProcessNumber Result to result element . Also Give minOccurs =1 & maxOccurs = unbounded
Step 14: Click on source mode & view the xsd coding
[9] Business Intelligence Solution Providers
<?xml version="1.0" encoding="UTF-8"?> <schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:fobj="http://xmlns.oracle.com/SOAApps/FlowNProcess/FlowNProcess" [10] Business Intelligence Solution Providers
targetNamespace="http://xmlns.oracle.com/SOAApps/FlowNProcess/FlowNProcess" xmlns="http://www.w3.org/2001/XMLSchema"> <element name="process"> <complexType> <sequence> <element name="ProcessNumber" maxOccurs="unbounded"> <complexType> <sequence> <element name="NumberA" type="integer"/> <element name="NumberB" type="integer"/> </sequence> </complexType> </element> </sequence> </complexType> </element> <element name="processResponse"> <complexType> <sequence> <element maxOccurs="unbounded" ref="fobj:ProcessNumberResult"/> </sequence> </complexType> </element> <element name="ProcessNumberResult" type="fobj:ProcessNumberResultType"/> <complexType name="ProcessNumberResultType"> <sequence> <element name="NumberA" type="integer"/> <element name="NumberB" type="integer"/> <element name="Addition" type="integer"/> <element name="Subtraction" type="integer"/> <element name="Multiplication" type="integer"/> <element name="Division" type="decimal"/> </sequence> </complexType> </schema> Step 15: Click on FlowProcess.bpel & open bpel process
[11] Business Intelligence Solution Providers
Step 16 : Drag & drop FlowN Activity from component palette for nesting other activities on it & expand flowN activity by clicking plus sign [+]
Step 17: Drag & drop assign activity between receive & AssignTempVar
flowN
activity
& rename it as
[12] Business Intelligence Solution Providers
Step 18: To create global variables click on variable icon then "Variable" window will appear ----> Click on Green plus ---> Create Variable window will appear ---> Name = NVar ---> click on Type ---> Click on Browse icon & choose integer type ---> ok
Step 19: Again Click on Green plus ---> Create Variable window will appear ---> Name = IndexVar --> click on Type ---> Click on Browse icon & choose int type ---> ok [13] Business Intelligence Solution Providers
Step 20: Now click OK
Step 21: Now double Click on AssignTempVar to open & edit it [14] Business Intelligence Solution Providers
Step 22: Drag & drop Expression icon into NVar
[15] Business Intelligence Solution Providers
Step 23: Select BPEL XPath Extension Functions under Functions then select & click on Count Nodes --> Insert Into Expressions ---> select ProcessNumber ---> Insert Into Expression the expression should look like this if any other thing appear delete it . ora:countNodes('inputVariable','payload',' /client:process/client:ProcessNumber') then click OK .
Step 24: Drag & drop Expression icon into IndexVar
[16] Business Intelligence Solution Providers
Step 25: Initialize IndexVar = 1
Step 26: Take overview of assigned values & then click OK
[17] Business Intelligence Solution Providers
Step 27: Drag & drop Scope Activity inside FlowN activity & expand it by clicking on + sign
On clicking + sign scope will expand as shown below :
Step 28: Drag & drop invoke activity from component palette & rename it as InvokeParallelFlow to invoke ParallelProcessingservice
[18] Business Intelligence Solution Providers
Note : Before invoking any service we need its concrete wsdl i.e wsdl containing binding & service information also . Step 29: Open Oracle's Home ---> jdeveloper ---> mywork --->SOAApps--> ParallelProcessing---> Copy ParallelProcess.wsdl
Step 30: : Open Oracle's Home ---> jdeveloper ---> mywork --->SOAApps-->FlowNProcess ---> paste ParallelProcess.wsdl
[19] Business Intelligence Solution Providers
Step 31: Open Parallelprocess.wsdl from FlowNProcess in Text editor & make it Concrete wsdl by adding xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" & Binding , service Information from run time concrete wsdl from parallel processing inside enterprise manager coding is shown below : <?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions name="ParallelProcess" targetNamespace="http://xmlns.oracle.com/SOAApps/ParallelProcessing/ParallelProcess" xmlns:client="http://xmlns.oracle.com/SOAApps/ParallelProcessing/ParallelProcess" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ TYPE DEFINITION - List of services participating in this BPEL process The default output of the BPEL designer uses strings as input and output to the BPEL Process. But you can define or import any XML Schema type and use them as part of the message types. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -> <wsdl:types> <schema xmlns="http://www.w3.org/2001/XMLSchema"> <import namespace="http://xmlns.oracle.com/SOAApps/ParallelProcessing/ParallelProcess" schemaLocation="xsd/ParallelProcess.xsd"/> </schema> </wsdl:types> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MESSAGE TYPE DEFINITION - Definition of the message types used as part of the port type defintions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -> <wsdl:message name="ParallelProcessRequestMessage"> <wsdl:part name="payload" element="client:process"/> </wsdl:message> <wsdl:message name="ParallelProcessResponseMessage"> <wsdl:part name="payload" element="client:processResponse"/> </wsdl:message> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PORT TYPE DEFINITION - A port type groups a set of operations into a logical service unit. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -> <!-- portType implemented by the ParallelProcess BPEL process --> <wsdl:portType name="ParallelProcess"> <wsdl:operation name="process"> <wsdl:input message="client:ParallelProcessRequestMessage"/> <wsdl:output message="client:ParallelProcessResponseMessage"/> </wsdl:operation> [20] Business Intelligence Solution Providers
</wsdl:portType>
<wsdl:binding name="ParallelProcessBinding" type="client:ParallelProcess"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="process"> <soap:operation style="document" soapAction="process"/> <wsdl:input> <soap:body use="literal"/> </wsdl:input> <wsdl:output> <soap:body use="literal"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="ParallelProcessService_ep"> <wsdl:port name="ParallelProcess_pt" binding="client:ParallelProcessBinding"> <soap:address location="http://soabpm-vm:7001/soainfra/services/default/ParallelProcessing/ParallelProcessService_ep"/> </wsdl:port> </wsdl:service> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PARTNER LINK TYPE DEFINITION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~> <plnk:partnerLinkType name="ParallelProcess"> <plnk:role name="ParallelProcessProvider"> <plnk:portType name="client:ParallelProcess"/> </plnk:role> </plnk:partnerLinkType> </wsdl:definitions> Step 32: Click refresh button till concrete wsdl parallelProcess.wsdl would shown below :
[21] Business Intelligence Solution Providers
Step 33: Right click on PartnerLinks swim lane & click on Create Partner Link
Step 34: Fill all required fields Name = ParallelFlowRef WSDL URL = Browse ParallelProcess.wsdl Patner Link Type = ParallelProcess Partner Role = ParallelProcessProvider My Role = Not Specified Click OK
[22] Business Intelligence Solution Providers
Step 35: Now we have Successfully Refrenced ParallelFlowRef now we can observe it on Partner links swim lane .
Step 36: Right click on InvokeParallelFlow
Step 37: Edit Invoke Name = InvokeParallelFlow Partner Link = Browse ParallelFlowRef Operation = Process Input = Click on Green Plus & Create variable window will appear 1. Name= InvokeParallelFlow_process_Input_Variable 2. Type = leave as it is 3. Select local variable Click ok [23] Business Intelligence Solution Providers
Step 38: Similarly Output = Click on Green Plus & Create variable window will appear 4. Name= InvokeParallelFlow_process_output_Variable 5. Type = leave as it is 6. Select local variable Click ok
[24] Business Intelligence Solution Providers
Step 39: look at the variable window & click ok to save the local invoke variables inside scope.
Step 40: Now we have established wiring between InvokeParallelFlow & ParallelFlowref. Click twice on AssignInvokeInput to edit it
[25] Business Intelligence Solution Providers
Step 41: Map From input Variable/payload//client:processNumber/client:numberA InvokeParallelFlow_process_InputVariable/payload //ns1:process/ns1:NumberA Variable/payload//client:processNumber/client:numberA InvokeParallelFlow_process_InputVariable/payload //ns1:process/ns1:NumberA
TO TO
Step 42: Since we have N number of values of ProcessNumber hence edit FlowNProcess.bpel in source mode by writing [$IndexVar] after client:ProcessNumber as show below <assign name="AssignInvokeInput"> <copy> <from variable="inputVariable" part="payload" query="/client:process/client:ProcessNumber[$IndexVar]/client:NumberA"/> <to variable="InvokeParallelFlow_process_InputVariable" part="payload" query="/ns1:process/ns1:NumberA"/> </copy> <copy> <from variable="inputVariable" part="payload" query="/client:process/client:ProcessNumber[$IndexVar]/client:NumberB"/> <to variable="InvokeParallelFlow_process_InputVariable" part="payload" query="/ns1:process/ns1:NumberB"/> </copy> </assign>
[26] Business Intelligence Solution Providers
Step 43 : To create global variables click on variable icon then "Variable" window will appear ----> Click on Green plus ---> Create Variable window will appear ---> Name = TempProcessNumberResult ---> click on Element ---> Click on Browse icon
[27] Business Intelligence Solution Providers
Step 44: Choose ProcessNumberResult then click OK
Step 45: Click ok
Step 46: Drag & drop Assign activity below InvokeParallelFlow from component palette & rename it as AssignTempParallelProcess then double click on it to edit it
[28] Business Intelligence Solution Providers
Step 47: Map From InvokeparallelFlow_Process_OutputVariable to TempProcessNumber
If we want to map in source mode then code is written below : <assign name="AssignTempParallelProcess"> <copy> <from variable="InvokeParallelFlow_process_OutputVariable" part="payload" query="/ns1:processResponse/ns1:NumberA"/> <to variable="TempProcessNumberResult" query="/client:ProcessNumberResult/client:NumberA"/> </copy> <copy> <from variable="InvokeParallelFlow_process_OutputVariable" part="payload" query="/ns1:processResponse/ns1:NumberB"/> <to variable="TempProcessNumberResult" query="/client:ProcessNumberResult/client:NumberB"/> </copy> <copy> <from variable="InvokeParallelFlow_process_OutputVariable" part="payload" query="/ns1:processResponse/ns1:Addition"/> <to variable="TempProcessNumberResult" query="/client:ProcessNumberResult/client:Addition"/> </copy> <copy> <from variable="InvokeParallelFlow_process_OutputVariable" part="payload" query="/ns1:processResponse/ns1:Subtraction"/> [29] Business Intelligence Solution Providers
<to variable="TempProcessNumberResult" query="/client:ProcessNumberResult/client:Subtraction"/> </copy> <copy> <from variable="InvokeParallelFlow_process_OutputVariable" part="payload" query="/ns1:processResponse/ns1:Multiplication"/> <to variable="TempProcessNumberResult" query="/client:ProcessNumberResult/client:Multiplication"/> </copy> <copy> <from variable="InvokeParallelFlow_process_OutputVariable" part="payload" query="/ns1:processResponse/ns1:Division"/> <to variable="TempProcessNumberResult" query="/client:ProcessNumberResult/client:Division"/> </copy> </assign> Step 48: Drag & drop Assign activity below AssignTempParallelProcess from component palette & rename it as AssignOutput then double click on it to edit it
Step 49:Map TempProcessNumberResult/client:ProcessNumberResult to outputVariable/payload/ client:processResponse & then Append it .
[30] Business Intelligence Solution Providers
Step 50: Drag & drop Expression into IndexVar & then Click on IndexVar---> Insert Into Expression ---> +1
[31] Business Intelligence Solution Providers
Step 51: Deploy FlpowNProcess Project by right clicking on left pane on FlpowNProcess -->Deploy --> FlpowNProcess ---> Application server --->devsoa (select server domain) -->AdminServer---> Next ---> Finish
Deployment finished
Step 52: Click On browser ---> Start Enterprise manger -----> login using credentials (username : weblogic & password : welcome1) , now click twice on FlpowNProcess [1.0] composite then Click on Test to test the composite instance
[32] Business Intelligence Solution Providers
Step 53:Select Number of node =3 & then click on Explore tab
Step 54: Fill all the required fields as input NumberA = 80 & NumberB=70 NumberA = 60 & NumberB=50 NumberA = 40 & NumberB=30
[33] Business Intelligence Solution Providers
Step 55: Click on Test Web Service
And get Response shown below: Step 56: Now we have got three output concurrently then click on Launch Flow Trace as shown below :
[34] Business Intelligence Solution Providers
Step 57:Observe that all states of composite instance are completed & three times invoke activity had called ParallelProcessReference .Click on FlowNProcess to open Flow diagram
Step 58: Click on Flow
Step 59: Observe that the index is incremented & all the three invoke activities are invoked in parallel i.e all the N flows are processing concurrently.
[35] Business Intelligence Solution Providers
[36] Business Intelligence Solution Providers
Step 60: Now again open Trace & click on ParallelProcess & view its Flow diagram.
Step 61: Click on Flow & observe ParallelProcess Flow that all the operations are also processing simultaneously & concurrently
Step 62: Open FlowProcess dashboard & click on Shut Down tab to shutdown composite instance
[37] Business Intelligence Solution Providers
Step 63: Click Yes
Now successfully Shutdown the composite
Finally logout Enterprise Manager & stop admin server .
[38] Business Intelligence Solution Providers