Thursday, 5 December 2013

Oracle SOA - Interview Questions Part-2

Oracle SOA - Interview Questions Part-2


Question: What is role of Mediator?
Answer: 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.

Question: Difference between Mediator & OSB?
Answer: OSB is all together different tool which is used for integration like SOA but the main purpose of OSB is to route the information and same we can do with mediator. The main difference two is, we go for Mediator when we want to route information between different components inside composite and go for OSB when we want to route the information between composites. Mediator is used light weight mediation and OSB is used for heavy weight mediation.


Question: What is echo in Oracle Mediator?
Answer: The purpose of the echo option is to expose all the Oracle Mediator functionality as a callable service without having to route it to any other service. For example, you can call an Oracle Mediator to perform a transformation, a validation, or an assignment, and then echo the Oracle Mediator back to your application without routing it anywhere else.

For synchronous operations with a conditional filter, the echo option does not return a response to the caller when the filter condition is set to false. Instead, it returns a null response.

The echo option is available for asynchronous operations only if the Oracle Mediator interface has a callback operation. In this case, the echo is run on a separate thread.

Question: What is resequencing in Mediator ?
Answer: The resequencing feature of the Oracle Mediator reorders sets of messages that might arrive to the Oracle Mediator in the wrong sequence. You can define resequencing for all operations in an Oracle Mediator or for a specific operation.

Question: Resequencing options available in mediator?
Answer:
Standard (based on input Id)
FIFO(based on time)
Best Efforts

Question: What is Schematron Validation?
Answer: Schematron is an XML schema language, and it can be used to validate XML contents in an XML payload.


Question: Types of routing exist in Mediator?
Answer: Static & Dynamic Routing.


Question: What is Dynamic Routing in Mediator ?
Answer: A dynamic routing rule lets you externalize the routing logic to an Oracle Rules Dictionary, which in turn enables dynamic modification of the routing logic in a routing rule.

When you choose to create dynamic routing rule then it creates a new business rule service component that is wired to the Oracle Mediator service component within the SOA composite of the Oracle Mediator service component. The business rule service component includes a rule dictionary. The rule dictionary is a metadata container for the rule engine artifacts, such as fact types, rulesets, rules, decision tables and so on.Inside routing rules, you need to set endpoint URI.

Question: Types of Static Routing rules?
Answer: Sequential & Parallel.

Question: Difference between Sequential & Parallel static routing rules ?
Answer:
           Sequential
            parallel


Oracle Mediator evaluates routings and performs the resulting actions sequentially. Sequential routings are evaluated in the same thread and transaction as the caller Oracle Mediator queues and evaluates routings in parallel in different threads.The messages of each Oracle Mediator service component are retrieved in a weighted, round-robin fashion to ensure that all Oracle Mediator service
components receive parallel processing cycles. This is true even if one or more Oracle Mediator service components produce a higher number of messagescompared to other components. The weight used is the message priority set when designing an Oracle Mediator service component. Higher numbers of parallel processing cycles are allocated to the components that have higher message priority.
You can set the Priority field in the Mediator Editor to indicate the priority of anOracle Mediator service component. Priorities can range from zero to nine, with nine being the highest priority. The default priority is four. Oracle Mediator always enlists itself into the global transaction propagated through the thread that is processing the incoming message. For example, if an
inbound JCA adapter invokes an Oracle Mediator, the Oracle Mediator enlists itself with the transaction that the JCA adapter has initiated.Oracle Mediator initiates a new transaction for processing each parallel rule. The initiated transaction ends with an enqueue to the Oracle Mediator parallel message dehydration store.

For example, if an Oracle Mediator service component has one parallel routing rule, one message is enqueued on the Oracle Mediator parallel message dehydration store.

The parallel message dispatcher to the store then initiates a transaction, reads the message from the database store, and invokes the target component or service of this routing rule. The transaction initiated by the listener thread is a completely new transaction and is propagated to the target components. Oracle Mediator propagates the transaction through the same thread as the target components while executing the sequential routing rules.

Oracle Mediator never commits or rolls back transactions propagated by external entities. Oracle Mediator commits or rolls back transactions because it is the initiator of these transactions. If an operation or event has both sequential and parallel routing rules, first sequential routing rules are evaluated and actions are performed, and then parallel routings are queued for parallel execution. Oracle Mediator manages the transaction only if the thread-invoking Oracle Mediator does not already have an active transaction. For example, if Oracle Mediator is invoked from inbound SOAP services, Oracle Mediator starts a transaction and commits or rolls back the transaction depending on success and failure.

Question: Which static routing rule support fault policy ?
Answer: Parallel rules only.

Oracle SOA - Interview Questions Part-1

Oracle SOA - Interview Questions Part-1


Question : What is Web Service ?
Answer: Web service is a piece of code which is available on web (internet). That code of piece can be developed in any language (java, .net etc). A client invokes the web service by sending xml message and it wait for xml response (synchronously or asynchronously).
Question: Explain About Web service?

Web service is type of software system which is used for exchange the data and use information from one machine to another machine through network. Generally Web services based on the standards such as TCP/IP, HTTP, Java, HTML and XML.
Web services are pure xml based which is used for exchange information through Internet to direct application to application interaction. These systems include programs, objects, messages or documents.
Many software applications written in various programming languages and running on various platforms can use web services to exchange data over computer network.
You can develop Java-based web services on Solaris and that is accessible from your V.B Program that runs on windows.
Question: What is WSDL ?
Answer : WSDL stands for Web Services Description Language

WSDL is a document written in XML. The document describes a Web service. It specifies the location of the service and the operations (or methods) the service exposes.

Question: Explain elements/tags of WSDL ?
Answer : 
Element Name
Description
types
A container for abstract type definitions defined using XML Schema
message
A definition of an abstract message that may consist of multiple parts, each part may be of a different type
portType
An abstract set of operations supported by one or more endpoints (commonly known as an interface); operations are defined by an exchange of messages
binding
A concrete protocol and data format specification for a particular portType
service
A collection of related endpoints, where an endpoint is defined as a combination of a binding and an address (URI)

Question: Difference between Abstract and Concrete WSDL ?
Answer : Abstract WSDL contains only messages and operations. Abstract WSDL is
used by SOAP Server.

Where as concrete WSDL contains messages, operations and transport
specific information (JMS or Http). This is used by SOAP client.

Question : What is SOAP ?
Answer : SOAP is a simple XML-based protocol to let applications exchange information over HTTP.
Or more simply: SOAP is a protocol for accessing a Web Service.

Question : What is XML Schema ?
Answer : An XML Schema describes the structure of an XML document.

Question : Difference between Include and Import in context to XML schema ?
Answer : The fundamental difference between include and import is that you must use import to refer to declarations or definitions that are in a different target namespace and you must use include to refer to declarations or definitions that are (or will be) in the same target namespace.

Question : What is 
targetNamespace's function?
Answer :
<schema xmlns="http://www.w3.org/2001/SchemaXML         targetNamespace="http://www.example.com/name"         xmlns:target="http://www.example.com/name">

The targetNamespace declares a namespace for other xml and xsd documents to refer to this schema. The target prefix in this case refers to the same namespace and you would use it within this schema definition to reference other elements, attributes, types, etc. also defined in this same schema definition.
Question : How to refer another XSL from main XSL file ?
Answer :  The <xsl:import> element is a top-level element that is used to import the contents of one style sheet into another.

Note: This element must appear as the first child node of <xsl:stylesheet> or <xsl:transform>.
Syntax: <xsl:import href="URI"/>


Question: Why we use Call-template inside XSL ?
Answer : Call-template works similar to the apply-template element in XSLT. Both attach a template to specific XML data. This provides formatting instructions for the XML. The main difference between the two processes is the call function only works with a named template. You must establish a 'name' attribute for the template in order to call it up to format a document.
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
< xsl:call-template name="myTemplate">
< !-- Content: xsl -->
< /xsl:call-template>
< stylesheet>



Question: Difference between XA & Non-XA transaction ?
Answer:
Non-XA (Local Transaction):  It involves only one resource. When you use Non-XA transaction then you can’t involve multiple resources (different databases, Queues, application servers etc), you can rollback or commit transaction for only one resource. There is not transaction manager for this transaction as we are dealing with only one resource at a time.

XA (Global Transaction): It involves more than one resource (different databases, queues, application servers) all participate in one transaction. It uses two-phase commit to ensure that all resources either all commit or rollback any particular transaction. When you have scenario like you need to connect to two different databases, JMS Queue and application server, in this case you will use XA transaction that means all resource participate in one transaction only.

Question: What is inline schema ?
Answer: Inline schemas are XML schema definitions included inside XML instance documents. Like external schema documents, inline schemas can be used to validate that the instance matches the schema constraints.

Question: what is the use of Pick Activity?
Answer: This activity waits for the occurrence of one event in a set of events and performs the activity associated with that event. The occurrence of the events is often mutually exclusive (the process either receives an acceptance or rejection message, but not both). If multiple events occur, the selection of the activity to perform depends on which event occurred first. If the events occur nearly simultaneously, there is a race and the choice of activity to be performed is dependent on both timing and implementation.

Thursday, 31 October 2013

Oracle SOA 11g - BAM


Simple:Integarting BAM with BPEL in SOA Suite 11g:


The Oracle BAM Adapter is a Java Connector Architecture (JCA)-compliant adapter that can be used from a Java EE client to send data and events to the Oracle BAM Server. The Oracle BAM Adapter supports the following operations on Oracle BAM data objects: inserts, updates, upserts, and deletes.
The Oracle BAM Adapter can perform these operations over Remote Method Invocation (RMI) calls (if they are deployed in the same farm), direct Java object invocations (if they are deployed in the same container), or over Simple Object Access Protocol (SOAP) (if there is a fire wall between them).
Oracle BAM Adapter is configured in Oracle WebLogic Server Administration Console to provide any of these connection pools

What is ?
Business Activity Monitoring is a tool that is useful in monitoring business services and processes. It actively collects data, applies rules and reports information to users. When something goes wrong in business processes, BAM can be configured to take corrective measures such as emailing administrators/support team.
How does BAM interface with other SOA applications?
BAM uses Data Objects to capture and store information from other sources. It uses Real Time Data Streaming to stream data through  Adapter, JMS connector, ODI or web service API.
We are going to explore the features of BAM through a simple use-case as shown below:
image
Description: Employee information is sent to BAM Example Process ().  sensors sends this information through BAM Adapter to populate Employee Data Object in BAM. Employee Dashboard report will capture this information and show in the form of a 3D Bar chart.
Steps to implement use-case:
  1. Create Employee Data Object
  2. Create BAM Report
  3. Configure BAM Adapter
  4. Create BPEL Sensor Activity and Sensor Action
1. Create Employee Data Object
  • Open BAM console using http://<yourhost>:9001/OracleBAM
  • Open BAM Architect
image
  • Click on "Create Data Object" and enter "Employee" in the name field.
  • Click on "Add Field" and add following fields: id (Auto-incrementing Integer), name (String), department (String).
orafmwschool_bam05
  • Click on "Create Data Object" to finish creation. You can optionally create a sub-folder to hold Employee object.
  • Make sure Employee object is visible under Data Objects section.
image
2. Create BAM Report
  • Open Active Studio
image
  • Click on "Create a New Report".
image
  • Click on first option: Single tiled Report.
  • Enter "Employee Dashboard" for Report title and select "3D Bar Chart" as report type.
image
  • Select "Employee" object from Data Objects section at the bottom and click on Next button.
  • Select “Department” in Group By section, “id” in Chart Values and “Count” in Summary Function(s). Click on Next and then Finish button.
image
  • Save this report and it will be visible through "Recent Reports" in Home tab. This report now shows Employee count grouped by Department.
3. Configure BAM Adapter
  • Open Weblogic Server Administration Console.
  • From left side Domain Structure section, select Deployments.
image
  • Search and select "OracleBamAdapter".
  • Click on "Configuration" and "Outbound Connection Pools" from OracleBamAdapter settings page.
image
  • We can see predefined connection pools for RMI and SOAP connections. Expand both connection factory links. We need to configure these connection pools to use BAM server.
image
Important: Repeat following steps for both "eis/bam/rmi" and "eis/bam/soap".
  • Open “eis/bam/rmi” link and enter Outbound connection properties as follows. Replace connection parameters as per your installation. Hit “Enter” key after entering each property value. Click on Save once you’ve finished.
image
  • Open “eis/bam/soap” and enter connection parameters as follows. Hit “Enter” key after entering each property value. Click on Save once you’ve finished.
image
Note: The UserName field should contain an Oracle BAM user who is a member of application-level role Administrator or Report Architect. “weblogic” user by default is an Administrator.
  • Clik on OracleBamAdapter from Deployments page. Go to Control tab. Select OracleBamAdapter, click on Stop and then Start buttons. Now, Oracle BAM Adapter is ready for use.
4. Create BPEL Sensor Activity and Sensor Action
  • Create an empty Generic Project and name is BAMExample.
  • Import following employee.xsd file into BAMExample project.
  • Create one-way BPEL process and name it BAMExampleProcess. Select Employee element from Project Schema Files for Input message for the service.
image
  • Double click on BAMExampleProcess in composite.xml to open the BPEL process.
  • Click on Monitor button at the top right corner of the process window to change to Monitor view.
image
  • Right click on receiveInput activity and create sensor.
image
  • Change Evaluation Time to Completion. This will activate sensor after the completion of receiveInput activity. Select Employee element for inputVariable as shown below.
image
  • From BAMExampleProcess Structure window, right click on Sensor Actions and Creatte –> BAM Sensor Action …
image
  • Select ActivitySensor_1 for Sensor property. Choose Employee Data Object from BAM Data Object Chooser.
  • Select “Insert” as Operation type. One other interesting operation is Upsert that stands for Update/Insert. This operation creates an object if one does not exist or updates an existing one.
  • Ensure BAM Connection Factory JNDI value is “eis/bam/rmi”. We can specify “eis/bam/soap” in case BAM and BPEL servers are separated by a Firewall.
image
  • Create a new mapping between BAM data object and BPEL input variable as shown below.
image
  • Establish XPATH mapping.
image
  • Click on OK to close Sensor Action creation Dialog.
  • Right click on BAMExample bpel process and deploy to SOA Server.
Test BAMExample process
  • Go to BAMExample in Enterprise Manager and Test the process.
image
  • Enter Oracle1 and ORACLE for name and department respectively. Click on Test Web Service.
image image
  • Open BAM Active Viewer. Click on “Select Report” and choose “Employee Dashboard” report we saved earlier. We can see the updated graph. Experiment with different values.
image

Tuesday, 29 October 2013

Oracle SOA 11g - HTTP Binding Adapter

Invoking REST services in SOA 11g using HTTP Binding :

If you want to invoke HTTP methods like GET or POST in SOA composite application for that HTTP Binding Adapter is available that can be use to invoke REST services. For example if you have a web application that has a servlet that takes HTTP GET request with some parameter and returns an XML response.

So here I am demonstrating with an example. Create a SOA project with empty composite

Create an sample 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="Request">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="FName" type="xsd:string"/>
        <xsd:element name="LName" type="xsd:string"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="Response">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="Name" type="xsd:string"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>

Drop a Http Binding adapter in exposed services name it HttpTest click next in HTTP Binding Configuration.









 

 

 

 

Here you can specify type as service or reference, service type one way or request response, operation name and type of HTTP GET or POST.
In Request message either you can select existing element from a schema or select the wizard to create it .


Create a bpel process with Define Service later template



Wire service and bpel process



In Bpel process drop a receive activity with create instance checked and connect it with partner link


 In assign activity use concat function to assign name to output variable.

Deploy the application and test this through web browser...!!!

http://subbu-sony:7001/soa-infra/services/default/HTTPBindingDemo/HttpService 

Oracle SOA 11g - Mediator


Mediator:

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. Mediator converts data to facilitate communication between different interfaces exposed by different components, which are wired together to build a SOA composite application. For example, a Mediator can accept data contained in a text file from an application or service, transform it to 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 a Mediator component to consume a business event or to receive a service invocation. A Mediator component can evaluate routing rules, perform transformations, validate, and either invoke another service or raise another business event. You can use a Mediator component to handle returned responses, callbacks, faults, and timeouts.
This section provides an overview of Oracle Mediator features:
  • Content-Based and Header-Based Routing
  • Synchronous and Asynchronous Interactions
  • Sequential and Parallel Routing of Messages
  • Transformations
  • Validations
  • Java Callout
  • Event Handling
  • Dynamic Routing
  • Error Handling
  • Multiple Part Message Support
  • Mediator Echo Support

Oracle Mediator provides support for setting rules based on message payload or message headers. You can select elements or attributes from the message payload or the message header and based on the values, you can specify an action. For example, Mediator receives a file from an application or service containing data about new customers. Based on the country mentioned in the customer's address, you can route and deliver data to the database storing data for that particular country. Similarly, you can route a message based on the message header.
  • Synchronous and Asynchronous Interactions
Oracle Mediator provides support for synchronous and asynchronous request response interaction. In a synchronous interaction, the client requests for a service and then waits for a response to the request. In an asynchronous interaction, the client invokes the service but does not wait for the response. You can specify a timeout period for an asynchronous interaction, which can perform some action, such as raise an event or start a process. Sequential and Parallel Routing of Messages
A routing rule execution type can be either parallel or sequential. You can configure the execution type from Routing Rules panel.


  • Transformations
Oracle Mediator supports data transformation from one XML schema to another. This feature enables data interchange among applications using different schemas. For example, you can transform a comma-delimited file to the database table structure.
  • Validations
Oracle Mediator provides support for validating the incoming message payload by using a Schematron or an XSD file. You can specify Schematron files for each inbound message part and Oracle Mediator can execute Schematron file validations for those parts.
  • Java Callout
Oracle Mediator provides support for Java callout. Java callouts enable the use of Java code, together with regular expressions.
  • Event Handling
An event is message data sent because of an occurrence of an activity in a business environment. Oracle Mediator provides support for subscribing to business events or raising business events. You can subscribe to a business event that is raised when a situation of interest occurs. For example, you can subscribe to an event that is raised when a new customer is created and then use this event to start a business process such as sending confirmation email. Similarly, you can raise business events when a situation of interest occurs. For example, raise a customer created event after completing the customer creation process.
  • Dynamic Routing
Dynamic Routing separates the control logic, which determines the path taken by the process, from the execution of the process. You can create a dynamic routing rule from the Mediator Editor.
  • Error Handling
Oracle Mediator supports both fault policy-based and manual error handling. A fault policy consists of conditions and actions. Conditions specify the action to be carried out for a particular error condition.
  • Mediator Echo Support
Oracle Mediator supports echoing source messages back to the initial caller after any transforms, validations, assignments, or sequencing are performed.
  • Multiple Part Message Support
Oracle Mediator supports messages consisting of multiple parts. Some Remote Procedure Call (RPC) web services contain multiple parts in the SOAP message.



Difference between Mediator and BPEL
You have many tools to use in a composite, and they may overlap for some cases. Mediator is particularly useful for content based routing of events, and as a listener for events. BPEL of course offers more possibilities for business logic and would generally be suited to defining process logic. A more complex SOA composite likely includes both components and others as well.

Mediator serves the purpose of a bus. It can be best utilized when used for routing. It can do routing based on many parameters and the best part is, the routing rules can be modified at runtime, thus giving the flexibility to choose the target at any point in time.
BPEL
1) Complex Logic
2) Good Support language in form of”activities”
3) Performance wise very slow
4) Support of Dehydration and Instance Monitoring
5) For Long Running process BPEL is the Right Solution
6) To implement the controlled Transactions
Integration of Rules Engine and Human Workflow
7) To implement the service virtualization BPEL is not the right approach

Mediator
1) Less Complex Logic
2) Less Support
3) Three times faster than BPEL
4) No support of de hydration
 5) For Long Running process not a proper solution
6) You cannot control the transactions in Mediator.
7) Mediator is the right approach for the service virtualization

Virtualization – Service virtualization provides companies with the ability to create virtual services that offer a stable interface (location, transport, standards, policies, messages) even when the physical service changes.  Virtualization offers high-availability and load-balancing, performance and SLA monitoring and management, routing, versioning, and mediation capabilities to mitigate the impact of change at the provider on service consumers.
Mediator is used for Transformation and Routing.
Routing------------------Static routing and Dynamic Routing
Static----------------Serviced Based & Event Based
Dynamic------------Business Rules


  • Oracle Enterprise Service Bus (OESB)
    • Old „ESB“–OESB was the primary ESB prior to BEA acquisition.
    • After acquisition of BEA its role is to provide mediation services between SOA Suite components
    • In 11g this will be known as the Mediator and acts as a component in an SCA assembly
    • OESB is the only ESB available if running on a non-Weblogic server
  • Oracle Service Bus (OSB)
    • Previously known as BEA Aqualogic Service Bus (ALSB)
    • Oracle’s primary service bus
    • the preferred platform for service virtualization and interactions external to the SOA Suite
    • Currently OSB is only available on WebLogic server but the intention is provide it on other platforms as well in the future
    • OSB is the foundation of service bus functionality moving forward
    • Can be used independently, without SOA Suite




Mediator vs. Oracle Service Bus (OSB)
  • Mediator
    • The “tiny”, “light weight” service bus
    • Limited to simple Mediator functionality for the implementation of the VETRO pattern
      • V alidade
      • E nrich
      • T ransform
      • R oute
      • O perate
    • Value Mapping and Cross-Reference Table for supporting the canonical datamodel
    • Development through JDeveloper IDE
    • Event Delivery Network for Publish-Subscribe semantic
    • Message Transformation with XSLT
    • Can be used and deployed as a SCA component
  • Oracle Service Bus (OSB)
    • The large, powerful service bus
    • Extended functionality important for enterprise-wide Integration, like
      • Message Throttling
      • Service Pooling
      • Reliable Messaging
    • Development through Eclipse IDE or Web Console
    • Message Transformation over XQuery and XSLT
    • OSB specific deployment

**************************************************************************

Mediator is a new component(ESB in 10g )that has been added to Oracle SOA Suite 11g.

What does the Mediator do?

It mediates components/services within an SOA Composite Application.
Routes the requests to the Services
Data Transformation between formats and protocols
It DOES NOT do service localisation and it cannot act as a Gateway to the Services.

How is it different from Oracle Service Bus?

The main difference is in the scope. Mediator performs intra-composite mediation while Oracle Service Bus performs inter-composite mediation which means that it mediates different composites together.

What should be done by a Mediator?

In Oracle, every BPELProcess is a Composite Service. This Composite could be invoking multiple BPEL Processes or Components. The Contract is defined at the Composite Service and the Mediator plays the role of mediation between this Contract and the various contracts for other components within the Composite.
I think that it is a good practice to create a Mediator in all Composites even if the Composite has a single BPEL Process. The Mediator will help take care of additional operations that could be added to this Service in future.
I think that it is a good practice to do all data transformations at the Mediator.
Mediator can also perform routing of requests to different Services. But, I think that one should explore if this can be delegated to BPEL as its core stength is to orchestrate the services.
Anything that does not belong to a process has to be extracted out and put in the Mediator. For example, if the process needs the data in a certain format then that transformation can be done at the Mediator or the OSB but not in the BPEL.

****************************************************************