Sunday, 15 December 2013

Mediater In Oracle SOA 11g


HI Guys

Lets Understand Mediater in Bpel in this post.
Oracle Mediator is a service component of the Oracle SOA Suite that provides mediation capabilities such as selective routing, transformation, and validation capabilities, along with various message exchange patterns, such as synchronous, asynchronous, and event publishing or subscriptions.
Oracle Mediator provides a lightweight framework to mediate between various components within a composite application. Oracle Mediator converts data to facilitate communication between different interfaces exposed by different components that are wired to build a SOA composite application. For example, Oracle Mediator can accept data contained in a text file from an application or service, transform it into a format appropriate for updating a database that serves as a customer repository, and then route and deliver the data to that database.
Oracle Mediator facilitates integration between events and services, where service invocations and events can be mixed and matched. You can use an Oracle Mediator service component to consume a business event or receive a service invocation. An Oracle Mediator service component can evaluate routing rules, perform transformations, validate, and either invoke another service or raise another business event. You can use an Oracle Mediator service component to handle returned responses, callbacks, faults, and timeouts.

Oracle Mediator provides the following features:
1.Content-Based and Header-Based Routing
2.Synchronous and Asynchronous Interactions
3.Sequential and Parallel Routing of Messages
4.Transformations
5.Validations
6.Java-callouts

Requirement : This is the Main BPEL process that wires up the earlier two BPEL process that we developed , Mediator helps is transforming and routing the input request to BPEL process 1 ( that writes into DB Adapter based on Approval) or BPEL process 2 ( that writes to File adapter based on Business rule)

Based on check in variable in Input variable mediator routes the message to desired BPEL Process

below is the xsd I used: StudentDetails.xsd

<?xml version="1.0" encoding="windows-1252" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns="http://www.example.org"
            targetNamespace="http://www.example.org"
            elementFormDefault="qualified">
  <xsd:element name="StudentDetails">
  <xsd:complexType>
  <xsd:sequence>
   <xsd:element name="StudentNo" type="xsd:int"/>
  <xsd:element name="StdentName" type="xsd:string"/>
  <xsd:element name="Sub1" type="xsd:integer"/>
  <xsd:element name="Sub2" type="xsd:integer"/>
  <xsd:element name="Sub3" type="xsd:integer"/>
  <xsd:element name="GrandTotal" type="xsd:integer"/>
  </xsd:sequence>
  </xsd:complexType>
    </xsd:element>
</xsd:schema>
 

Create a New SOA Project with Mediator,

 

Create  a mediater with Interface definition from wsdl



Add a web service Adapter , tie up both the BPEL wsdls by giving its corresponding webservice URLs



Here are Mediation Rules

If Max Salary is greater than 300 it calls BPEL Process 1 WebService, if max salary less than 300 then BPEL Process 2 Web service is called



edit Assign Values in Mediator.plan as below



Final Mediator.plan looks as below



Test cases

 Test the Service with two inputs 
case:  GrandTotal < 300 ex: 280
case:  GrandTotal>=300 ex:410


HappyLearning


                                                                                                                By Deepthi Reddy



No comments:

Post a Comment