Mediator: Mediator is a light weight component and a distributed middleware system used to integrate dissimilar application or component.
Mediator receives the client requests and transforming the request using XSLT mapper to targeted services or references.
- Provides mediation capabilities such as routing, transformation, and validation capabilities.
- Provides a lightweight framework to mediate between various components within a composite application
- Provides services like
- Content based routing and header based routing
- Sequential and parallel routing of messages
- Message re-sequencing
- Data transformation
- Synchronous and Asynchronous Interactions
- Payload validation
- Event Handling
- Java-callouts
When you compare your Mediator with BPEL, using Mediator you can achieve everything what you achieve using BPEL. But it will be difficult to implement complex logic in Mediator.
But if you want to implement the re-sequencing of incoming message before calling to external system/process, which can’t be achieve with BPEL. In this case we only Mediator can solve the problem. now lets see Here I have given the sample to create Mediator project in Oracle Fusion Middleware 11G.
or
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 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.
Step by step procedure to develop mediator 11G sample.
1. Create SOA application and right click and select New Project :

2. Select projects on that select SOA project and click OK

3. Enter the SOA project name and click Next:

4. Select Composite with mediator and click Finish :

5. Create Mediator Window appears then, Give proper Mediator Name & select Template Define Interface later.
6.Create xsd(xml schema).
In left pane Application navigator-- Select your Project---- select xsd folder in that project.
right click the xsd folder & select new.
In New Gallery window select all technologies--- select categories XML, in right pane select xml Schema & click on Ok
It displays create XML Schema window, Give proper xsd name, Directory, Target namespace & clickk on Ok.
It creates xsd file, it shows design view select source view, & paste the below given code & save it.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
| <?xml version="1.0" encoding="windows-1252" ?><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xsd:element name="BalanceRequest"> <xsd:annotation> <xsd:documentation> A sample element </xsd:documentation> </xsd:annotation> <xsd:complexType> <xsd:sequence> <xsd:element name="accountNumber" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="BalanceResponse"> <xsd:complexType> <xsd:sequence> <xsd:element name="accountBalance" type="xsd:double"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="BalanceFault"> <xsd:complexType> <xsd:sequence> <xsd:element name="faultString" type="xsd:string"/> <xsd:element name="faultActor" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:element></xsd:schema> |
After saving the xsd, select design view it looks like the given below.
7. From Mediator component drag to add new service
It displays create new webservice window
In create webservice window give proper name, type will be service, & select the icon WSDL URL as Generate WSDL From Schema.
In this Create WSDL Window select Interface Type, As requirement of your project, here i selectd Synchonous interface. In input part select Add message part(+) in right side, it displays the Add message part window, give proper partname & select url by clicking on search button, it display type chooser select Request service, & click on ok,
In the same manner, select message part to output & Fault also & click on ok. it displays the connection between mediator & webservice(in exposed services)
10. Then Drag and Drop the mediator component to create new external reference.

11. Give the details to create external reference from webservice wsdl url like shown below and select portType and Click OK


One more example reg to mediator,
Use-case: In banking systems or customer care center, when ever a customer approaches the system, a token id or request id will be issued based on the category/type of issues. For e.g. banks will issue a token id based on saving account or current account or demat account issue etc. when it comes to processing of the request, banks will process the customers in a sequence order. So the customer is supposed to submit the token id issued to them. If any customer bypasses other customers, the system will process those request until their turn comes up.
Implementation: Refer to this video link for implementation






No comments:
Post a Comment