In this tutorial, I am following the book ‘Getting Started with Oracle SOA Suite 11g R1 – A Hands-On Tutorial’ and prepared the tutorial for latest SOA versions as many of the options are changed. I have performed the complete development actions and recreated for the developers those who want to learn SOA development from scratch.
Service Oriented Architecture is a loosely couple software development paradigm used now a days widely on enterprise application development. Service Oriented Architecture is an architectural framework for the software design which mainly deals with services. A service is generally an automation process which is transferred the actual services that reside in the world. The key areas of Service Oriented Architecture is given below,
v Service Oriented Architecture
o Application Frontend
o Service
§ Contract
§ Implementation
· Business Logic
· Data
§ Interface
o Service Repository
o Service Bus
The key expectations of Service Orientation are,
v Cost reduction for IT application development
v Increased business agility
v Change Resilience
v Continuous improvement of operations
v Better communication between business and IT
Service Oriented Architecture essential disciplines are,
v Loose coupling – Consumer refers service contracts instead of implementations.
v Discoverability – Self-described
v Location transparency – Virtual services for consumers and calls physical services.
v Autonomy – Manage own dependencies
v State management – State management as per service contract
v Reusability – Reuse shared resources directly or via composition
v Composability – Easily compose the service from other services
Oracle SOA Suite is a Fusion Middleware Product from Oracle for adhering Service Orientated Architecture in Enterprise Solutions. SOA Suite provides below high level components,
v Service Component Architecture
v Oracle Service Bus
v Business Activity Monitoring
Oracle JDeveloper is the IDE or Design tool for all Oracle SOA suite components. In Oracle SOA Suite 11g, all design time artifacts are consolidated in the Metadata Store (MDS), a repository that holds all artifacts.
SOA Infrastructure is the common runtime environment for executing composites and the service engines will be plugged into the environment. Below are the service engines that Oracle SOA Suite provides,
v BPEL – Orchestration
v Mediator – Filter, Route, and Transformation
v Business Rules – Decision services
v Human Workflow – Workflow engine
Oracle Service Bus is a high-performance service bus that provides,
v Service Virtualization
v Protocol Translation
v Request Routing
v Traffic Shaping
Oracle Business Activity Monitoring is a monitoring tool for real-time dashboards to business users.
The WSDL of a webservice contains below XML artifacts,
v WSDL Definition
o Operations
o Input Parameters
o Output Parameters
o Protocols
v XML Schema Definition (XSD)
o XML Elements
o Element Types
o Input Parameters
o Output Parameters
The SOA infrastructure incorporates a Metadata Service (MDS), which allows the developers to create a library of XML artifacts that we can share across SOA Composites. MDS supports two types of repositories:
v File based repository
v Database repository
XML library required a standard file structure.
v src
o xmllib
§ core
§ Project A
· edl
· fpb
· sch
· wsdl
· xsd
§ Project B
Purchase Order Processing – Practice Tutorial
Use case stories:-
v All the orders need to be persisted to disk for bookkeeping and auditing purpose
v Small orders (under $1000) are to be approved automatically
v Large orders should go through a validation and approval process
o The customer’s credit cards must be validated
o If the order is $5000, or more, customer service representative must manually approve the order
v The status of the approved orders will be set to “Approved”
v The status of large orders with an invalid credit card will be set to “invalidCreditCard”
v The status of large orders rejected by customer service representative will be set to “rejected”
v All the approved orders are sent to the fulfillment service which uses the order value to determine the shipping company to use:
o Orders under $1000, go through USPS
o Orders >=$1000 && Orders < $5000, go through USPS
o Orders >= $5000, go through FedEx
Business Process Logic
Install DB Schema
grant connect, resource to soademo identified by soademo;
commit;
CREATE TABLE CREDITCARDINFO
(
SSN VARCHAR2(15) NOT NULL,
FIRST_NAME VARCHAR2(30),
LAST_NAME VARCHAR2(30),
CCNUMBER VARCHAR2(20) NOT NULL,
CREDITRATING NUMBER,
STATUS VARCHAR2(20) NOT NULL
);
insert into CREDITCARDINFO VALUES (
'111-11-1111',
'Neena',
'Kochhar',
'1234-1234-1234-1234',
'3'
, 'VALID'
);
insert into CREDITCARDINFO VALUES (
'222-22-2222',
'Steven',
'King',
'5678-5678-5678-5678',
'4'
, 'VALID'
);
insert into CREDITCARDINFO VALUES (
'333-33-3333',
'Lex',
'De Haan',
'4321-4321-4321-4321',
'5'
, 'INVALID'
);
insert into CREDITCARDINFO VALUES (
'444-44-4444',
'Alexander',
'Hunold',
'8765-8765-8765-8765',
'1'
, 'VALID'
);
Basic Integration Tools
v Bindings – Webservice Bindings:
o Used for
§ Inbound – expose SOA composite applications over SOAP
§ Outbound – Consume external SOAP services
v Adapters
o Database Adapter: make service enabled databases
v Mediator : Interconnecting within a SOA application- filtering and making routing decisions
Building Credit Card Validation Service
Input: Credit Card Number
Output: Status - Valid or Invalid
Implementation Approach: Implementation uses below components.
v Webservice binding – Webservice binding receives a request over SOAP
v Mediator – Mediator route the request to the Database Adapter
v Database Adapter – Database Adapter execute a query against the database and return the result
Database table: - CREDITCARDINFO
Table Structure:-
COLUMN_NAME
|
DATA_TYPE
|
NULLABLE
|
SSN
|
VARCHAR2(15 BYTE)
|
No
|
FIRST_NAME
|
VARCHAR2(30 BYTE)
|
Yes
|
LAST_NAME
|
VARCHAR2(30 BYTE)
|
Yes
|
CCNUMBER
|
VARCHAR2(20 BYTE)
|
No
|
CREDITRATING
|
NUMBER
|
Yes
|
STATUS
|
VARCHAR2(20 BYTE)
|
No
|
Table Data:-
SSN
|
FIRST_NAME
|
LAST_NAME
|
CCNUMBER
|
CREDITRATING
|
STATUS
|
111-11-1111
|
Neena
|
Kochhar
|
1234-1234-1234-1234
|
3
|
VALID
|
222-22-2222
|
Steven
|
King
|
5678-5678-5678-5678
|
4
|
VALID
|
333-33-3333
|
Lex
|
De Haan
|
4321-4321-4321-4321
|
5
|
INVALID
|
444-44-4444
|
Alexander
|
Hunold
|
8765-8765-8765-8765
|
1
|
VALID
|
Application Development:-
JDeveloper Version :
Open JDeveloper and create new SOA application. Select File à New, select “General à Applications” from the left pane and “SOA Application” from the right pane.
Enter the Application details given below or use your own application name and click ‘Next’.
Enter Project Name and SOA technology is already selected. Click ‘Next’
Select Composite Template as ‘Empty Composite’ from the list and click ‘Finish’
Once the application creation is done, composte.xml file will be created and can see three swim lanes. JDeveloper creates the SOA Application with a project and it opens the composite.xml. This file contains three swim lanes,
v Exposed Services
v Components
v External References
Create the XSD for the input and output parameter.
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.globalcompany.com/ns/CCAuthorizationService"
targetNamespace="http://www.globalcompany.com/ns/CCAuthorizationService" elementFormDefault="qualified">
<xsd:element name="creditcardStatusRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="CCNumber" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="creditcardStatus" type="xsd:string"/>
<xsd:element name="error" type="xsd:string"/>
</xsd:schema>
Add Database Adapter: - Drag and drop the Database Adapter from component palette to External References swim lane.
This will start the Database Adapter Configuration wizard.
Step 1:- Welcome to the Adapter Configuration Wizard.
Click “Next’
Step 2:- Service Name. Enter the desired service name and click ‘Next’
Step 3:- Service Connection.
Create the Database connection by clicking on the green + sign.
Enter the Database connection details and test the connection and make sure the Test Connection shows “Success”
Enter the JNDI Name and keep note of this name as we need to update this in the SOA Server DB Adapter.
JNDI Name : eis/DB/SOADemoDatabase
Step 4:- Operation Type
Select the radio button “Perform an operation on a table” and click on the check box “Select” and uncheck all other options and click ‘Next’.
Step 5:- Select table.
Click on ‘Import Tables’ button and it will open Import Table window.
Click on ‘Query’ button and it will search all the available objects in the connected database.
Select ‘CREDITCARDINFO’ table from the available tables list.
Move the table ‘CREDITCARDINFO’ to the selected table list and click ‘OK’.
Step 5: Select Table
Click ‘Next’
Step 7:- Relationships
Click ‘Next’.
Step 8: Attribute Filtering
Select only ‘status’ check box and uncheck the rest enables checkboxes.
Step 9:- Define Selection Criteria
Click on ‘Add’ button of the parameters section and enter the parameter name.
Click on ‘Edit’ button of the SQL section.
Click on ‘Add’ button to create the expression.
Click ‘Edit’ button of the First Argument section and select ‘ccnumber’ from the list.
Select ‘Parameter’ radio button for the second argument and select ‘ccnb’ from the dropdown.
Step 10:- Advanced Options
Keep the values as it is and click ‘Next’
Step 11:-Finish
Click on ‘Finish’ button.
Add Mediator Component
Drag and drop Mediator component from component palette to Components swim lane.
This will initiate the Mediator Configuration Wizard.
Enter the mediator name and select the Template as “Define Interface Later” and click ‘OK’.
Add the Webservice Binding
Drag and drop ‘Web Service’ from component palette to Exposed Services swim lane.
This will open the Webservice configuration wizard.
Enter the service name.
Click on the second button ‘Generate WSDL from Schema’
Select Interface Type as ‘Synchronous Interface’
v Do XSLT transformation on the message payload. This is required do the different format of DB adapter (getCreditValidation) output and publicly exposed Webservice (getStatusByCC).
We have two options to deploy the application.
Option 1:- Create the application server connection in the JDeveloper and deploy the application to the application server directly from the JDeveloper.
Option 2 :- Deploy the application to SAR file and deploy the application using em console.
Once the deployment is completed,
Below URL is the webservice URL and can be tested using any client.
Below URL is the webservice URL and can be tested using any client.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cca="http://www.globalcompany.com/ns/CCAuthorizationService">
<soapenv:Header/>
<soapenv:Body>
<cca:creditcardStatusRequest>
<cca:CCNumber>1234-1234-1234-1234</cca:CCNumber>
</cca:creditcardStatusRequest>
</soapenv:Body>
</soapenv:Envelope>
Response
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing">
<env:Header>
<wsa:MessageID>urn:1C5EAE60414711E79F0CA9BAE60FE637</wsa:MessageID>
<wsa:ReplyTo>
<wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>
<wsa:ReferenceParameters>
<instra:tracking.ecid xmlns:instra="http://xmlns.oracle.com/sca/tracking/1.0">303833ad407d512c:-25f8f5fe:15bc85f6738:-8000-00000000003b2acb</instra:tracking.ecid>
<instra:tracking.compositeInstanceCreatedTime xmlns:instra="http://xmlns.oracle.com/sca/tracking/1.0">2017-05-25T16:38:53.051+04:00</instra:tracking.compositeInstanceCreatedTime>
</wsa:ReferenceParameters>
</wsa:ReplyTo>
<wsa:FaultTo>
<wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>
<wsa:ReferenceParameters>
<instra:tracking.ecid xmlns:instra="http://xmlns.oracle.com/sca/tracking/1.0">303833ad407d512c:-25f8f5fe:15bc85f6738:-8000-00000000003b2acb</instra:tracking.ecid>
<instra:tracking.compositeInstanceCreatedTime xmlns:instra="http://xmlns.oracle.com/sca/tracking/1.0">2017-05-25T16:38:53.051+04:00</instra:tracking.compositeInstanceCreatedTime>
</wsa:ReferenceParameters>
</wsa:FaultTo>
</env:Header>
<env:Body>
<inp1:creditcardStatus xmlns:inp1="http://www.globalcompany.com/ns/CCAuthorizationService">VALID</inp1:creditcardStatus>
</env:Envelope>
Excellent article. Very interesting to read. I really love to read such a nice article. Thanks! keep rocking.
ReplyDeleteOracle SOA Online Training Bangalore
Really nice blog post.provided a helpful information.I hope that you will post more updates like this Oracle SOA Online course
ReplyDeleteHyderabad
Thank you ever so for you article. Really Cool.
ReplyDeletesalesforce online training in hyderabad
salesforce online training hyderabad
Thank For sharing Valuable Information
ReplyDeleteOracle SOA Suite Training
Oracle SOA Training in Hyderabad
Thanks for your information. very good article.
ReplyDeleteSOA Online Training
Oracle SOA Suite Training
I really liked your blog post.Much thanks again. Awesome.
ReplyDeleteOracle SOA Training in Hyderabad
Oracle SOA Online Training India
Thank you for introducing like this tool. keep it update.
ReplyDeleteSOA Training
Oracle SOA Training
I really liked your blog post.Much thanks again. Awesome.
ReplyDeleteSOA Online Training
Oracle SOA Suite Training
Thank you for introducing this tool. keep it updated.
ReplyDeleteOracle SOA Online Training Hyderabad
SOA Training in Hyderabad