BEPl composite

 BPEL(Business Process Execution Language):

We can design Synchronous, ASynchronous, Oneway type of Service by Using BPEL

When you drag a BPEL Process it will generate 3 files

.xsd --- it will process inputs to the webservice and brings output from the webservice

.wsdl----it will describe the webservice and locate the webservice ( It will genrate a WSDL URL once you deploy the project)

.bpel---- We will see BPEL activities inside the BPEL process. We can design the Business process by using bpel activities


1.Synchronous Process( request - reply) - 1 port : In Synchronous process you will submit a request and you will get a response with in Some time frame. The default time limit for synchronous process is 45 Sec..

If it exceeds that time limit, you will get timeout error

There will be only one port in Synchronous process Input and output will travel in the same port....

Examples: Online ticket booking, Online Order Booking, On-line Money Transfer

can we change the default time limit???

Yes, We can change the default time limit for synchronous process. through Syncmaxwaittime property.

Log in EM console

SOA Administation------BPEL Properties-------Advanced properties -------Syncmaxwaittime

When you select Synchronous BPEL Process the default BPEL activities are...Receive and Reply......

2.Asynchronous Process( Request - Callback) - (2 ports):

In Asynchronous process there is a delay in response, There is no time limit in asynchronous process

You will submit a request and you will callback the response after some time there is no time limit

there are two ports in Asynchronous process, in One port input will travel, in another port output will travel...

Examples: Applying for a Bank loan, House loan request, Applying for a Credit Card request,   etc.....

when you are selecting BPEL Asynchronous process, by default activities  are receive and callback( invoke)

3. One Way Process ( Fire and Forget) : 1 port

 When you are not expecting any response you will work with One Way Process...

In one way process you will submit a request and forget...you won't get any response...

There will be only one port in One way process, Only Input will travel in that port....

When you select one way BPEL process only receive activity will be available....

Example: if we have a file and we want to insert that data into Database....

we will work with one way process

Promotional Messages

Promotional Emails...

If you are not expecting any response

4. Define Service Later:  you are not clear about the process we will work with Define

 Service later. 

Initially you will take Define Service Later and later you can convert that process into either synchronous, Asynchronous or one way process...Based on that we will manually drag BPEL activities and define the ports.....

Examples: In adapters initially  we will take define service Later and convert into One way process

5. Base on WSDL:

If we want to call the existing service which is already available in Production we can copy the WSDL URL and we can access that service based on WSDL.

EX: In case we want to modify anything additional in existing BPEL process we will work with Base on a WSDL...

If we want to fix any issues in existing BPEL process

6. Subscribe to Events:

If we want to Subscribe the existing business events we will work with Subscribe to Events

while working with Event Delivery Network, We will work with Subscribe to events

BEPL Activates: 

1.Partnerlink: If you want to call your external webservices into BPEL process we will create
                         Partner links. We need WSDL URL to create Partnerlink
                         We can call both Synchronous or Asynchronous Webservices, Based on that
                         automatically ports will create.


2.Receiv:e : Receive activity will interact with Partnerlink(webservice) or Event and
         receives the input variables

         by clicking on + icon we can create the variables
 




 3.Reply: Reply activity will send the response(output) to the partnerlink or event
       
       by clicking on + icon we can create the variables

4.Assign : Assign activity is used to map the variables from Source to Target

                 To copy the variables from Source to Target By clicking on Expression Builder we can write functions also
                  we can use Mathematical functions, String functions, logical functions date functions etc.



5.Transform:  Transform activity is used for mapping the variables from Source to Target, We can Copy the variables from Source to Target by using Transform activity, Transform activity will generate .xsl file
We can use different functions in Transform like Mathematical functions, String functions,                       logical functions 
While mapping we can use some conditions like For each, If, Choose, When etc
when we have large number of variables we will prefer Transform activity by using for each we can perform auto mapping. by using .xsl file we can transform XML into other formats also



6. Wait activity:  To delay your BPEL process we are working with Wait activity



7.Pick Activity : Pick activity on message branch will interact with Partnerlink or event
                            and receives the input message.by clicking on + icon we can create the
                            variables.
                            We can add on alram  branch to display the timeout error. we can configure the
                            time limit in On alarm Branch based on that time limit it will display the timeout error.

                            once you configure time, if you are receiving the message with in that
                            time frame it will go to on message branch, if it exceeds that time limit
                           it will go to on alarm branch and displays the timeout erro

                              


8.Invoke Activity:  Invoke activity will interact with Partnerlinks( Sync and Asynch)
Invoke activity is Two way with Synchronous Partnerlink(it will give input and brings output from partnerlink)

Invoke activity is One way with Asynchronous Partnerlink(It will give only input)
Synchronous has time limit to send the response that's why invoke is two way with Synchronous


9.Empty:  Empty doesn't perform anything, It will help you to block the variables in case of fault variables, it will block the fault variables.



10.Notification activities: You can send a notification by e-mail, voice mail, fax, pager, or short message service (SMS)

11.Java Embedding: This activity enables you to add custom Java code to a BPEL process using the
Java BPEL exec extension <bpelx:exec>.





12.Flow activity :( Parallel Process at design time):TO perform Parallel Processing we are working with Flow activity
When we know the project flow, we will take this activity at design time and
perform the parallel processing.

13.FLowN activity :  Dynamically Parallel Processing.
when we are not sure about the project flow, Dynamically we can decide the flow at runtime we will work with FlowN activity.
14.If activity:  To validate the data by writing conditions we can write multiple conditions by expanding if branch if condition is matching it will execute that block otherwise it will go to else block
15.Scope activity : Scope activity is just a Sub block.. you can define sub operations, you can create local variables which is used with in Scope. You can define Catch and catchall blocks with in SCOPE. You can handle the faults with in SCOPE. it's a box you can hide the activities.



16.Sequence Activity: To execute the BPEL activities in a Sequential Order.



17.While activity: for looping purpose we will use while activity, For iteration Purpose we will use While activity
We need to write a condition to enter into the loop ,We need to write a condition to exit from the loop




18.Validate : TO validate the Variables.



19.Dehydrate : To add a Dehydration point. To save the BPEL transactions we will use dehydration.

20. Replay: TO re execute the activities inside a Scope



21. Xquery : Xquery is used for mapping purpose , we can write some functions it will generate .xqy file.


22. Repeat until : Repeatedly execute a contained activity

Exception( Error)  handling activities :

Catch : To handle the Known Faults , We are working with Catch Block
              To handle the System Faults, we are working with Catch Block

Catch All : To handle the Unknown Faults, We are working with Catchall Block

Throw : To Throw an exception, we will use throw activity In business faults or user defined faults, we are using throw activity

Rethrow : Rethrow a fault that has been caught in fault handler

Exit : Immediately terminates the process instance

Compensate : To rollback the successful operation we will use Compensate activity

Compensate Scope : Invoke the compensation handler of a Scope

Fault handlers: This are used to handle the errors and in SOA There are two types of faults handlers are their 

1) System Faults: System Faults can be called as in built faults Which is predefined in the system, System faults can be called as Technical faults or Runtime faults

System faults can be handled in two ways:

1) Process Based Approach: In process based approach we are working with Catch and Catchall
Catch ----TO handle the known faults we are working with Catch branch
Catchall --- TO handle the unknown faults, we are working with Catchall branch

2) Policy Based Approach: IN policy based approach we are writing XML files
i) fault-policy.xml,
ii)fault-binding.xml

i) fault-policy.xml: fault-policy file will have actions to handle the technical faults here
we will define composite name, revision id, fault names, namespace URI and actions
we will define actions like ora human intervention, ora retry, time interval, rethrow
Abort, Terminate etc.

Ora human intervention: When we get Remote fault, The Target system is down. In that scenario if we want to manually restart the target we are working with Ora Human Intervention action.

Ora Retry: Retrying again to connect with Target system

Time interval: Time gap to perform Retry

Rethrow: Rethrow the fault which has been caught in fault handler Fault policy to catch block

Abort : To abort the process

Terminate :To exit the process

fault-policy.xml file:

<?xml version="1.0" encoding="UTF-8" ?>
<faultPolicies xmlns="http://schemas.oracle.com/bpel/faultpolicy">
  <faultPolicy version="2.0.1" id="FaultpoliciesDemo"
               xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
               xmlns:xs="http://www.w3.org/2001/XMLSchema"
               xmlns="http://schemas.oracle.com/bpel/faultpolicy"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Conditions>
      <!-- Step #1: Add your fault handler for remote fault here: -->
      <faultName xmlns:bpelx="http://schemas.oracle.com/bpel/extension       name=bpelx:remoteFault">
        <conditon>
          <action ref="ora-human-intervention"/>
        </conditon>
      </faultName>
    </Conditions>
    <Actions>
      <!-- Step #4: Add the Action definition for handling mediator fauls using custom java here:-->
      <!-- Custom Java Handler: Logs the fault details to a log file -->
      <Action id="my-java-handler">
        <javaAction className="soatraining.faulthandling.MyFaultHandler"
                    defaultAction="ora-terminate" propertySet="myProps">
          <returnValue value="OK" ref="ora-rethrow-fault"/>
        </javaAction>
      </Action>
      <!-- Retry -->
      <Action id="ora-retry">
        <retry>
          <retryCount>4</retryCount>
          <retryInterval>2</retryInterval>
          <exponentialBackoff/>
        </retry>
      </Action>
      <!-- Rethrow action -->
      <Action id="ora-rethrow-fault">
        <rethrowFault/>
      </Action>
      <!-- Human Intervention -->
      <Action id="ora-human-intervention">
        <humanIntervention/>
      </Action>
      <!-- Terminate -->
      <Action id="ora-terminate">
        <abort/>
      </Action>
    </Actions>
    <!-- Property sets used by custom Java actions -->
    <Properties>
      <!-- Property set for MyFaultHandler customer java action -->
      <propertySet name="myProps">
        <property name="logFileName">myfaulthandler.log</property>
        <property name="logFileDir">c:\temp</property>
      </propertySet>
      <!-- Step #5: Add new property set for MyFaultHandler for logging Mediator faults here:-->
    </Properties>
  </faultPolicy>
</faultPolicies>

Different Types of system faults :

Remote fault: When ever server or system or Data base is slow then remote fault will occurs 

Selection Failure: When Xpath expression is empty we will get selection failure fault. in assign or transform we will get xpath expression when you map the 2 variables wise versa 

Miss match fault: if any  Mismatch while assigning in Xpath expression we will get Miss match fault
 
Timeout Fault: When there is a delay in response from the target system we will get Timeout fault.


ii)fault-binding.xml: It is used to To identify the fault in fault-binding file will have only Soa composite name, revision id and namespaces.. we wont have any actions in fault binding.xml file

fault binding file is attached with your SOA project to identify the faults.

Fault policy files will handle the technical faults with actions.

Fault policy files are reusable files.

Fault policy files:
<Composite_name>
<revision_id>
<namespaces>

<?xml version="1.0" encoding="UTF-8" ?>
<faultPolicyBindings version="2.0.1"
                     xmlns="http://schemas.oracle.com/bpel/faultpolicy"
                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <composite faultPolicy="FaultpoliciesDemo"/>
</faultPolicyBindings>

Advantages of fault policies compare to catch catchall block:

1) Centralized fault handling approach through MDS

2) Fault policy files are reusable files, we can map for other projects also

3) Manually recover the faults through ora human intervention action

4) Incase if we are adding any faults in fault policy files, no need to deploy your project again.

5) procedure handlers to handle the faults..

Technical faults faced in Project:

Remote Fault:( Target System DBA is responsible)

 when we are trying to connect with Target system or Server or Database

we are unable to connect with Target system due to system is down or server is down or database is DOWN

We are unable to connect the target and unable to invoke the target system we will get Remote Fault

For example: IF we want to insert data into Database, IF the database is down and we are unable

 to connect with target. We will get remote fault.

Invoke activity cant connect with target system we will get remote fault

In this scenario we will send email notifications to the DBA's or we will send messages to business team.

Binding Fault  ( SOA Developer responsible):

When Target system is available, Still we can't connect with target system

due to incorrect JNDI's or Incorrect configurations or Data issues

we will get Binding fault

JNDI -Java Naming Directory Interface, It's a logical connection to connect with sources and target system. in remote fault target system is down and we are unable to invoke.

2) Business Faults: Custom Faults As per the business Requirement we will generate this faults

Business faults are generated by using "Throw" activity

we will handle business' faults by using catch or catchall

we need to forcefully throw the business fault as per our business requirement...

we are not using fault policies for Business faults.....  No

we need to manually define namespace URI for Business faults....

Fault policies are used to handle only technical faults.....We don't use in Business Faults.

BPEL 1.1  Vs BPEL 2.0:

Few activities renamed in BPEL 2.0 and Few new activities introduced
1.Terminate renamed as EXIT
2.Switch activity renamed as IF...else
3.FlowN as For each

Below new activities introduced
1.Rethrow
2.repeat until
3.Compensate Scope










Comments

Popular posts from this blog

XML basics

EM console future