1. XML (Extensive markup language)
XML isstructuredlanguage.Startswithopeningtagendingwithclosingtag,inbetweenishasmultiple
childtags.
Followingisthe example of XMLstructure
<Employee>
<name>
<fname>abc</fname>
<lname>xyz</lname>
<mname>cde</mname>
</name>
<sal>10000</sal>
<dept>a1</dept>
</Employee>
In the above example Employeeisthe parentitcontainschildrenlike name,sal,and dept.Employee has
subchildrenlike fname,lname,andmname parentforthese tags are name. Likewise we canhave
childrenandsunchildrenforeachtag.
SOA (Service orientedArchitecture)
What is Service?
Service isnothingbutwe are gettingsomethingforourrequest.
Purpose of webservicesistoestablishacommunicationbetweendifferentplatformslike Java,.Net,and
PHP.
Initial dayswe donot have anytechnologytocommunicate differentplatformslike Java,.Net,andPHP.
All industryleadingcompany’sformagrouptheyfoundthe solutionisXML,to communicate different
platforms.Butprocessingof XML ismajor problem. Forprocessingof XML eachplatformhastheirown
kindof framework.
Java
.Net
PHP
2. To avoidthe processingof XML, once again the same groupthoughtand come up withnew solutionis
Webservices.Eachand everyplatformhastheirownimplementationof webservices.
Simple thingiswe needtodevelopacomponentinourplatformfinallywe will exposeitasWebservice.
The same service we will share inthe network,anyone canable accessit.
The inputand outputfor the webservicesinthe formof XML only.Butwe don’tneedtoprocessthe
XML. That is takingcare SOAPprotocol.
SOAP(Simple AccessObjectProtocol) isthe protocol usedcommunicate Webservices.
GenerallyHTTPisthe protocol to access webapplications,LikewiseSOAPisthe protocol toaccessweb
services
What is Protocol?
Protocol isnothingbut,itcontainssetof rulestoaccess the application.
We are usingmultiple protocolsinreal time toaccess differentkindof application
HTTP Web Applications
FTP to Process filesin remote/shareddirectory
SOAP WebServices
SOAPinternallyusesHTTPprotocol to communicate WebServices.
What is WebService?
Service availableinweblocationiswebservice.IthasURL addressto communicate.
What is interface?
If you see anykindof technologythere isaconceptcalledinterface,the purpose of interface is tohide
the businessimplementation.
Interface containsoperations(Methods)anditsinputandoutputstructure.
Webservice alsointerface,itcontainsoperationsanditsinputandoutputstructure.
Types ofcommunication (Message exchange pattern)?
Synchronous,Asynchronous,one-way
Synchronouscommunicationcontainsrequestandresponse, itmaintaincommunicationbetween
requestandresponse.
Asynchronouscommunicationcontainsrequest andresponse, itdoesnotmaintainanycommunication
between requestandresponse.
3. One-waycommunicationcontainsonlyrequest,noresponse.
What are the tags in WebService interface?
Followingare the tagsinwebservice - Types,Messages,Port type,Binding,Service.
Types containsXSDrelatedinformation,we canimportthe external XSDandalsoitmay containXSD
elementsaswell.
For eachSynchronousandAsynchronousoperationcontainstwo messages,inthe case of one-way
operationitcontainsonlyrequest message.
Port type containsall operationsrelated toservice.
Bindingcontainstype of communication,we have twotypesof communicationRPCandDocument,the
defaultcommunicationisDocument.Italsocontainswhatformatwe are passingthe datato operation
inputandwhat formatwe are gettingthe outputfromoperation(Literal orencoded).Literal topass
plaintextasdata and encodedtopass secure data.
Service containsCommunication address inthe formof URL.
inwebservice alsowe have three typesof operationsin portType (Sync,ASync, one-way). each
operationhasdifferent structure.
Sync :
<wsdl:portType name="execute_ptt">
<wsdl:operationname=" execute ">
<wsdl:inputmessage="tns:RequestMessage"/>
<wsdl:outputmessage="tns:ReplyMessage"/>
</wsdl:operation>
</ wsdl:portType>
one-way :
<wsdl:portType name="execute_ptt">
<wsdl:operationname="execute">
<wsdl:inputmessage="tns:RequestMessage"/>
</wsdl:operation>
</ wsdl:portType>
ASync :
<wsdl:portType name="execute_ptt">
<wsdl:operationname="execute">
<wsdl:inputmessage="tns:RequestMessage"/>
</wsdl:operation>
</ wsdl:portType>
<wsdl:portType name="execute_ptt_response">
4. <wsdl:operationname="executeResponse">
<wsdl:inputmessage="tns:ResponsetMessage"/>
</wsdl:operation>
</ wsdl:portType>
inthe above syncoperationcontainstwomessagesrequestandresponseinasingle portType,one-way
containsonlyrequestmessage inasingle portType.butinthe scenarioof ASync operationitcontains
twoportType's,each port type containssingle operation,eachoperationcontainsonlyinput message,
here response alsoconsideringas inputmessage.handlingof ASyncoperationwe have toimplement
differentapproach.
XSD (XML Schemadefinition)
XSD isthe definitionof XML structure.GenerallyXMListhe inputandoutput forwebservice operations.
We will define XMLinputandoutputstructure inXSD. So thatmy operationsshouldallowsame
structure of XML.
For creationof webservice interface we needtohave XSDinplace.
Followingisthe sample example structure of myinputandoutput.
I/P
<Employee>
<name>
<sal>
<dept>
</Employee>
O/P
<EmployeeResponse>
<Id>
</EmployeeResponse>
For the above I am providingthe XSDelements
<xsd:schemaxmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.example.org"
targetNamespace="http://www.example.org"
elementFormDefault="qualified">
<xsd:elementname="Employee">
<xsd:complexType>
<xsd:sequence>
<xsd:elementname="name"type="xsd:string"/>
<xsd:elementname="sal"type="xsd:int"/>
<xsd:elementname="dept"type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
5. </xsd:element>
<xsd:elementname="EmployeeResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:elementname="id"type="xsd:int"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
In the above we have createdtwoelements,one withthe name Employee andotherwiththe name
EmployeeResponse.
If elementcontainschild’swe needtouse the tagcomplexType.Siblingforthe complexType is
simpleType. Suppose if Iwantto applyrestrictionsonanyelementwe needtouse simpleType
Under complexType we have touse the followingtags sequence,all,andchoice,each tag has itsown
purpose.
Sequence fororderof elements, all forall elementsshould supportbutnoorder,butminOccursand
maxOccursvalue shouldnotbe greaterthan"1", andchoice shouldsupportonlyone elementfrom
elementslist.
Restrictionson element
We can applyfollowingrestrictionsonelementLength,Listof Values, Range of values,Pattern.
Length - we can specifyminLengthandmaxLengthforelement
Ex:
<xsd:elementname="name">
<xsd:simpleType>
<xsd:restrictionbase="xsd:string">
<xsd:minLengthvalue="10"/>
<xsd:maxLengthvalue="50"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
Above examplename elementshouldallow minimumof 10 characters and maximumof 50 characters.
List of Values - we can restrictthe elementtoallow specificlistof values.
Ex:
<xsd:elementname="name">
<xsd:simpleType>
<xsd:restrictionbase="xsd:string">
6. <xsd:enumerationvalue="abc"/>
<xsd:enumerationvalue="bcd"/>
<xsd:enumerationvalue="cde"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
inthe above sample name elementshouldallow only'abc','bcd','cde'. we have to repeatenumeration
for eachvalue.
Range of values - thiswe will applyonnumaricdata.
Ex 1:
<xsd:elementname="sal">
<xsd:simpleType>
<xsd:restrictionbase="xsd:int">
<xsd:minInclusive value="1"/>
<xsd:maxInclusivevalue="100000"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
inthe above sample sal shouldallow value inbetweenof 1 and100000, alsoit allow the value 1and
100000.
Ex 2:
<xsd:elementname="sal">
<xsd:simpleType>
<xsd:restrictionbase="xsd:int">
<xsd:minExclusive value="1"/>
<xsd:maxExclusivevalue="100000"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
inthe above sample sal shouldallow value inbetweenof 1 and100000, it won'tallow the value 1 and
100000.
Pattern - restrictionona seriesof values.
Ex 1:
<xsd:elementname="name">
<xsd:simpleType>
<xsd:restrictionbase="xsd:string">
<xsd:patternvalue="[A-Z][a-z][0-9]"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
7. inthe above sample name shouldallowonlytwocharectersandone digit.
Ex 2:
<xsd:elementname="name">
<xsd:simpleType>
<xsd:restrictionbase="xsd:string">
<xsd:patternvalue="[A-Z]+[a-z]*[0-9]"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
inthe above sample name shouldallow1or many uppercase letters,0or manylowercase letters,and
1 digit.inthe above sample '+' stande for1 or manyand '*' standsfor 0 or many.
We needtouse minOccurs and maxOccurs attributestodefine ArraysandcollectionsinXSD.
Ex 1:
<xsd:elementname="employees">
<xsd:complexType>
<xsd:sequence>
<xsd:elementname="employee"minOccurs="0"maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:elementname="name"type="xsd:string"/>
<xsd:elementname="sal"type="xsd:int"/>
<xsd:elementname="dept"type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
inthe above example"employees"parentelement,under"employees"we have "employee"child
element."employee" minOccursvalue is"0",itmeansit isnot mandatory. maxOccurs value
"unbounded",itmeansif itpresentitcanbe multiple times.
if we not provide anyvalue forminOccursand maxOccurs, by defaultvaluesare "1"and "1".
basedon the requirementwe cansetthe value for minOccurs and maxOccurs.
Below are the some sampleson minOccurs andmaxOccurs.
minOccurs="1" - meansminimumitshouldpresentonce inXML.
minOccurs="2" - meansminimumitshouldpresenttwotimesinXML.
maxOccurs="10" - maximumitshouldpresent10timesinXML.
maxOccurs="unlimited" - itshouldpresent"n"numberof timesinXML.
8. XML Attribute - we can define attribute withinaXML tag.
Ex 1:
<xsd:elementname="EmployeeDetails">
<xsd:complexType>
<xsd:sequence>
<xsd:elementname="EmployeeId"type="xsd:string">
<xsd:complexType>
<xsd:attribute name="fname"type="xsd:string"use="required"/>
<xsd:attribute name="mname"type="xsd:string"fixed="abc"/>
<xsd:attribute name="lname"type="xsd:string"default="abc"/>
</xsd:complexType>
</xsd:element>
<xsd:elementname="Salary"type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
inthe above example"employeeId"has3 attributesname "fname","mname",and"lname",we can
define fixedanddefaultvaluesforXMLattributesandalsowe can make it as "optional"or "required"
usingthe attribute "use",defaultvalueid"optional".
choice supportsanyone of the bellowelement.if we wanttopassgroup of elementsatruntime,we
have to group.
<?xml version="1.0"encoding="windows-1252"?>
<xsd:schemaxmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.example.org"
targetNamespace="http://www.example.org"
elementFormDefault="qualified">
<xsd:elementname="student">
<xsd:complexType>
<xsd:choice>
<xsd:groupref="totalGroup"/>
<xsd:groupref="avgGroup "/>
<xsd:groupref="gradeGroup"/>
</xsd:choice>
</xsd:complexType>
</xsd:element>
<xsd:groupname="totalGroup">
<xsd:all>
<xsd:elementname="s1"type="xsd:int"/>
<xsd:elementname="s2"type="xsd:int"/>
<xsd:elementname="s3"type="xsd:int"/>
<xsd:elementname="s4"type="xsd:int"/>
<xsd:elementname="s5"type="xsd:int"/>
</xsd:all>
9. </xsd:group>
<xsd:groupname="avgGroup">
<xsd:all>
<xsd:elementname="tot"type="xsd:int"/>
</xsd:all>
</xsd:group>
<xsd:groupname="gradeGroup">
<xsd:all>
<xsd:elementname="avg"type="xsd:int"/>
</xsd:all>
</xsd:group>
</xsd:schema>
at runtime,requestsupportsanyone of the group.groupswe needtocreate outside of the element.
Re-usability
reusable componentswe needtocreate outside of element,the same we willreferformultiple
elements.
ex:
<?xml version="1.0"encoding="windows-1252"?>
<xsd:schemaxmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.example.org"
targetNamespace="http://www.example.org"
elementFormDefault="qualified">
<xsd:elementname="employees">
<xsd:annotation>
<xsd:documentation>tjisisthe elementpassingtoinput</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:elementname="employee"minOccurs="0"maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:elementname="name"type="xsd:string"/>
<xsd:elementname="sal"type="xsd:int"/>
<xsd:elementname="dept"type="xsd:string"/>
<xsd:elementname="address"type="addressType"/>
<xsd:elementname="paddress"type="addressType"/>
</xsd:sequence>
<xsd:attributeGroupref="group"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexTypename="addressType">
<xsd:sequence>
11. The followingare the AdaptersinComposite
WebService
DB
JMS
File
FTP
AQ,like we have more to communicate thirdpartysystems.
CreatingProject in JDeveloper
OpenJDeveloper->in"ApplicationNavigator" ->fromdropDownclickon "New Application"
Applicationisnothingbuta folder,ithassome kindof configurationrelatedtoJDeveloper,we can
create multiple projectsinapplication.whenwe clickon"New Application"itopensthe followingpopup
12. inthe above popupwe have toprovide the Applicationname andthenclickonnext,itnavigatesto
projectcreationpopup,itlookslike bellow,inthe popupwe have toprovide the name of Projectand
selectthe type of projectfrom"available"andmove to"Selected"area.
inour case we have to select"SOA"from"Available Area"to"SelectedArea",formovingprojectsfrom
one area to otherarea,we have to use symbols">"and "<" available inbetweenof "Available"and
"Selected".
14. DeployingProject
Rightclickon projectand selectDeployasshowninthe bellow screen
it opensthe bellow popup screen, select"DeploytoApplicationserver"andclickon"Next"
It leadstofollowingpopupscreen,Select"Overwriteanyexistingcompositeswiththe same revisionID"
and un select"Keeprunninginstancesonafterredeployment"andclickon"Next"
15. it leadstonextpopup,here we needtoselectserverconnection,bydefaultitdonotshow any server
connection,we needtoaddthe serverconnection,foraddingserverconnectionwe needtoclickon"+"
symbol
17. it leadstofollowingpopup,here we have toprovide username andpassword,thenclickon"Next"
Username : weblogic
password: welcome1(thisiswhatwe providedwhile creatingdomain,itmaydiffertoeach)
it leadstonextpopup,here we have toprovide the domainname andclickon"Next"
WeblogicDomain: SOAOSBDomain (Domainname whatwe providedwhile creatingdomain)
18. it leadstonextpopup,here we needtoclickon"Test Connection", aftersuccessful testswe have to
clickon "Next"
inthe nextpopup,clickon"Finish".
Nowwe can selectthe createdserverandclickon "Next"
inthe nextscreenclickon"Next"andclickon "Finish"tocomplete the deployment.
For eachdomainwe needtocreate single serverconnectioninJDeveloper.
Note : Serverconnectionisone time configuration.
19. How to Add a Service Component
You create service components that implement the business logic or processing rules of your application.
You drag service componentsintothe designertoinvoke the initial propertyeditor.Thisactionenables
youto define the service interface (and,forasynchronousBPELprocesses,anoptional callback
interface).
The above Figure describesthe available service components.
StartingService ComponentEditors
DraggingThis Service
Component... InvokesThe...
BPEL Process Create BPEL Processdialog:Enablesyoutocreate a BPEL processthatintegrates
a seriesof businessactivitiesandservicesintoanend-to-endprocessflow.
BusinessRule Create BusinessRulesdialog:Enablesyoutocreate a businessdecisionbased
on rules.
Human Task Create HumanTask dialog:Enablesyoutocreate a workflow that describesthe
tasksfor usersor groupsto performas part of an end-to-endbusinessprocess
flow.
Mediator Create Mediatordialog:Enablesyoutodefine servicesthatperformmessage
and eventrouting,filtering,andtransformations.
20. BPEL (Business process execution language)
The purpose of BPEL isorchestrationof Services.BPELhasmultiple activitiestoorchestrate Services.
The followingexample describesthe procedurestoperformwhenaBPELprocessis draggedintothe
designer.
To add a service component:
1. From the ComponentPalette,selectSOA.
2. From the Service Componentslist,dragaBPEL Processintothe designer.The Create BPEL
Processdialogappears.
3. Enter the detailsshownin
Field Value
Name Enter a name (forthisexample,SayHellois entered).
Namespace Acceptthe defaultvalue.
Template SelectSynchronousBPELProcess.
For more informationaboutavailable templates,see the onlinehelp.
Expose asa
SOAPService
Deselectthischeckbox.Thiscreatesastandalone BPELprocess.If you selectthis
checkbox,aBPEL processand inboundwebservice bindingcomponentare each
createdand connected.
Introduction to Activities and Components
When you expand SOA Components in the Component Palette of Oracle BPEL Designer, service
components are displayed. Figure shows the components that display for a BPEL 1.1 process. A BPEL
2.0 process also shows the same components.
Figure A-1 SOA Components
21. Introduction to BPEL 1.1 and 2.0 Activities
This section provides a brief overview of BPEL activities and provides references to other documentation
that describes how to use these activities.
Oracle BPEL Designer includes BPEL 1.1 and BPEL 2.0 activities that are available for adding in a BPEL
process. These activities enable you to perform specific tasks within a process. Some activities are
available in both BPEL 1.1 and BPEL 2.0. Others are available in only BPEL 1.1 or BPEL 2.0.
To access these activities, go to the Component Palette of Oracle BPEL Designer. The activities display
under either of two categories:
BPEL Constructs: Displays core activities (also known as constructs) provided by standard BPEL
1.1 and 2.0 functionality. The activities in this category are displayed under additional
subcategories of Web Service, Activities, and Structured Activities in BPEL 1.1 and Web Service,
Basic Activities, and Structured Activities in BPEL 2.0.
Oracle Extensions: Displays extension activities that add value and ease of use to BPEL 1.1 and
2.0 functionality
Here I am explaining the purpose of each activity
1. Receive – isto read clientinputdata,itreadsthe data from exposedservice.ithasonlyone variable
that isinputvariable.
we needtodrag and drop the receive activityinBPELflow fromBPEL Constructs -> WebService,then
we needtodouble clickonreceive activity,itopensthe followingpopup.
We have to change followingpropertiesinReceiveactivitypopup,basedonourrequirement.
Name (optional) :Receive1(Default), generallywe needtocome upwithspecificname.
Operation: we needtoselectthe Service operation.
Create Instance : We needto selectthistostart the process.If we didnot checkit throwserror while
compilingcode.
Create InputVariable
22. 2. Reply– to sendresponse backtoclientthroughexposedservice.Ithasonlyone variable thatis
outputvariable
we needtodrag and drop the ReplyactivityinBPELflow fromBPEL Constructs -> Web Service,thenwe
needtodouble clickonReplyactivity,itopensthe followingpopup.
We have to change followingpropertiesinReplyactivitypopupbasedonourrequirement.
Name (optional) :Reply1(Default), generallywe needtocome upwithspecificname.
Operation: we needtoselectthe Service operation.
Create outputVariable.
3. Assign– to transferthe data betweenone variable tootherendvariable.UsingAssignactivitywe can
transferdata betweenanyvariabletoanyvariable like InputtoInput,InputtoOutput,Output toInput,
and Outputto Outputvariables.
we needtodrag and drop the AssignactivityinBPELflow fromBPEL Constructs -> Basic Activities,then
we needtodouble clickonAssignactivity,itopensthe followingpopup.
Clickon "General tab"inPopup
24. if we do the mappinginAssignactivity,foreachmapping itisgenerating single copyRule.itshould
looklike bellow
<copy>
<from>$Receive1_execute_InputVariable.part1/ns3:s1</from>
<to>$Invoke1_total1_InputVariable.parameters/sub1</to>
</copy>
inthe copyrule we have two tags,firstone is "from"and secondone is"to".
from- holdsthe data of source Variable
to - Is usedtopass the "fromdata" to target variable.
it isinternallyusingXPATHtoprocessthe variable data.
4. Invoke – isusedto invoke the externalservice oradapter.Ithas twoVariablesone inputandoutput
variable.
we needtodrag and drop the Invoke activityinBPELflow fromBPEL Constructs -> Web Service,thenwe
needtodouble clickon Invoke activity, itopensthe followingpopup.
We have to change followingpropertiesin Invoke activitypopup,basedonourrequirement.
Name (optional) :Invoke1(Default), generallywe needtocome upwithspecificname.
Operation: we needtoselectthe Service operation.
Create input/outputvariables.
25. usinginputvariable we passinputdatato service,the responsefromservice filledinoutputvariable.
5. Pick – pickis the activitywe use whenmyexposed service containsmultiple operations,receive
activitysupportssingle operation inexposedservice.
if my exposedservice containsmultipleoperationsBPELshouldsupportmultiple flows(single flowfor
each operation),we canachieve thisbyusingpickactivity.PickcontainsonMessage activityitworks asa
receive activity. ithasonlyone variable thatisinputvariable.
we needtodrag and drop the PickactivityinBPEL flow fromBPEL Constructs -> StructuredActivities,
defaultitopensone onMessage activity.eachonMessage activitysupports one operationinexposed
service (one flow).likewise we canaddmultiple onMessageflowsbasedonservice operations.
Note : Suppose myexposedservice contains10 operations, if we are planningtouse all operations,we
needtoadd 10 onMessage flowsinpickactivity.
We have to change followingpropertiesinpickactivitypopup,basedonourrequirement.
Name (optional tochange) :pick1(Default), generallywe needtocome upwithspecificname.
Create Instance : We needto selectthistostart the process.If we didnot checkit throwserror while
compilingcode.
27. 6. Flow Activity
Thisactivityenablesyoutospecifyone ormore activitiestobe performedconcurrently.A flow activity
completeswhen all activitiesinthe flow have finishedprocessing.Completionof aflow activityincludes
the possibilitythatitcan be skippedif itsenablingconditionisfalse.
For example,assumeyouuse aflowactivitytoenable twoloanofferproviders(UnitedLoanservice and
Star Loan service) tostart inparallel.Inthiscase,the flow activitycontainstwoparallel activities –the
sequence toinvoke the UnitedLoanservice andthe sequence toinvoke the StarLoanservice.Each
service cantake an arbitraryamountof time tocomplete theirloanprocesses. below figureshowsan
initial flowactivitywithitstwopanelsforparallelprocessing.Youdragactivitiesintobothpanelsto
create parallel processing.Whencomplete,aflow activitylookslikethatshowninFigure.
28. You can alsosynchronize the executionof activitieswithinaflow activity.Thisensuresthatcertain
activesonlyexecute afterotheractivitieshave completed.
Note:Oracle’sBPELimplementationexecutesflowsinthe same,single executionthreadof the BPEL
processand notin separate threads.
7. FlowN Activity
Thisactivityenablesyoutocreate multipleflowsequal tothe value of N,whichisdefinedatruntime
basedon the data available andlogicwithinthe process.Indexvariableincrementseachtime anew
branch iscreated,until the index variable reachesthe valueof N.
8. Compensate Activity
Thisactivityinvokescompensationonaninnerscope activitythathas successfullycompleted.This
activitycan be invokedonly fromwithinafaulthandleroranothercompensationhandler.
Compensationoccurswhenaprocesscannotcomplete several operationsaftercompletingothers.The
processmustreturnand undothe previouslycompletedoperations.Forexample,assumeaprocess is
designedtobooka rental car, a hotel,anda flight.The processbooksthe car and the hotel,butcannot
booka flightforthe correctday. In thiscase,the processperformscompensationbyunbookingthe car
and the hotel.The compensationhandleris invokedwiththe compensate activity,whichnamesthe
scope on whichthe compensationhandleristobe invoked.
belowFigure showsthe Compensate dialoginBPEL1.1. You can performthe followingtasks:
Clickthe General tabto provide the activitywitha meaningful name.
Selectthe scope activityonwhichthe compensationhandleristobe invoked.
Figure Compensate Dialog
29. In BPEL 2.0, the Compensate dialog does not include a Skip Condition tab.
9. Email Activity
Thisactivityenablesyoutosendan email notificationaboutanevent.
For example,anonlineshoppingbusinessprocessof anonline bookstoresendsacourtesyemail
message toyouafter the itemsare shipped.The businessprocesscallsthe notificationservice withyour
userID and notificationmessage.The notificationservice getsthe emailaddressfromOracle Internet
Directory.
10. If – conditional branching,basedonconditionitexecute the setof activities.
11. Wait – it holdsthe executionof process,specifiedtime.
we needtodrag and drop the waitactivityinBPEL flow fromBPEL Constructs -> Basic Activities.we
needtodouble clickonit to selectwaittime.
we have two optionstoselectwaittime
For
Until
30. For - we can specifytime inthe combinationof seconds, Minutes,Hours,Days,Months,andYears.
Until - till the particularperiodof time.
infor and until we have the expressiontoselectthe value atruntime.
12. Exit – terminate the runningprocess. itisnotgoodwayto use "Exit"in Synchronous BPELprocess.
Synchronous processexpectingsome response inaparticularperiod of time.if we terminatethe
processsynchronousprocessnevergetresponseback,soitraise exception.thatiswhywe are not using
"Exit"insynchronousprocess.
31. 13. Empty
Thisactivityenablesyoutoinsertano-operationinstructionintoaprocess.Thisactivityisuseful when
youmust use an activitythatdoesnothing(forexample,whenafaultmustbe caughtand suppressed).
14. Java EmbeddingActivity
Thisactivityenablesyoutoaddcustom Javacode to a BPEL processusingthe Java BPEL execextension
bpelx:exec.Thisisusefulwhenyouhave Javacode thatcan performa function,andwantto use this
existingcode insteadof startingover.InBPEL 2.0 projects,the bpelx:execextensionandJavacode are
wrappedinan <extensionActivity>element.
Thisactivityenablesyoutoaddcustom Javacode to a BPEL processusingthe Java BPEL exec
extension<bpelx:exec>.
Whenuserdouble clicksonthe Java embeddingicon,popupwindow will appearandusercan
enterthe javacode onit.
15. NotificationActivities
Thisactivityenablesyoutosendnotificationaboutaneventtoa user,group,or destination
address.
You can senda notificationbye-mail,voice mail,fax,pager,orshortmessage service (SMS).
16. Partner Link Activity
Thisservice enablesyoutodefinethe external serviceswithwhichyourprocessinteracts.A partnerlink
type characterizesthe conversational relationshipbetweentwo servicesbydefiningthe rolesplayedby
each service inthe conversationandspecifyingthe porttype providedbyeachservice toreceive
messageswithinthe conversation.Forexample,if youare creatingaprocessto interactwitha Credit
RatingService andtwoloan providerservices(UnitedLoanandStar Loan); youcreate partnerlinksfor
all three services.
32. A meaningfulname forthe service.
The webservicesdescriptionlanguage(WSDL) file of the external service.
The actual service type (definedas PartnerLinkType).
The role of the service (definedasPartnerRole).
The role of the processrequestingthe service (definedasMyRole).
17. Rethrow Activity
Thisactivityenablesyoutorethrow a faultoriginallycapturedbythe immediatelyenclosing
faulthandler.
Note:ThisactivityisonlysupportedinBPEL2.0 projects.
18. Scope Activity
Thisactivityconsistsof a collectionof nestedactivitiesthatcanhave theirownlocal variables,fault
handlers,compensationhandlers,andsoon.A scope activityisanalogoustoa { } blockina
programminglanguage.Eachscope hasa primaryactivity thatdefinesitsbehavior.The primaryactivity
can be a complex structuredactivity,withmanynestedactivitieswithinittoarbitrarydepth.The scope
issharedby all the nestedactivities.
33. Faulthandlingisassociatedwithascope activity.The goal isto undothe incomplete andunsuccessful
workof a scope activityinwhicha faulthas occurred.You define catchactivitiesinascope activityto
create a setof custom fault-handlingactivities.Eachcatch activityisdefinedtointerceptaspecific type
of fault.
Figure Fault-1showsthe AddCatch iconinside ascope activity. Figure Fault-2showsthe catchactivity
area that appearswhenyouclickthe AddCatch icon.Withinthe area definedasDropActivityHere,you
drag additional activitiestocreate faulthandlinglogictocatch and manage exceptions.Forexample,a
clientprovidesasocial securitynumbertoa CreditRatingservice whenapplyingforaloan.Thisnumber
isusedto performa creditcheck.If a bad credithistoryisidentifiedorthe social securitynumberis
identified asinvalid,anassignactivityinside the catchactivitynotifiesthe clientof the loanoffer
rejection.The entire loanapplicationprocessisterminatedwithaterminate activity.
Figure Fault-1 Catch Activity Icon
34. 19. Sequence Activity
Thisactivityenablesyoutodefine acollectionof activitiestobe performedinsequential order.For
example,youmaywantthe followingactivitiesperformedinaspecificorder:
A customerrequestisreceivedinareceive activity.
The requestisprocessedinsideaflow activitythatenablesconcurrentbehavior.
A replymessage withthe final approvalstatusof the requestissentbackto the customerina
replyactivity.
A sequence activitymakesthe assumptionthatthe requestcanbe processedina reasonable amountof
time,justifyingthe requirementthatthe invokerwaitfora synchronousresponse (becausethisservice
isofferedasa request-responseoperation).
Whenthisassumptioncannotbe made,itis bettertodefine the customerinteractionasapair of
asynchronousmessage exchanges.
Whenyoudouble-clickthe Sequence icon,the activityareashowninfigure appearsbellow.Dragand
define appropriateactivitiesinside the sequenceactivity.
20. Switch Activity
Thisactivityconsistsof an orderedlist of one or more conditional branchesdefinedinacase branch,
followedoptionallybyanotherwise branch.The branchesare consideredinthe orderinwhichthey
appear.The firstbranch whose conditionistrue istakenandprovidesthe activityperformed forthe
switch.If no branch witha conditionistaken,thenthe otherwise branchistaken.If the otherwise
branch isnot explicitlyspecified,thenanotherwise branchwithanemptyactivityisassumedtobe
available.The switchactivityiscompletewhenthe activityof the selectedbranchcompletes.
A switchactivitydiffersinfunctionalityfromaflow activity.Forexample,aflow activityenablesa
processto gathertwo loanoffersatthe same time,butdoesnotcompare theirvalues.Tocompare and
make decisionsonthe valuesof the twooffers,aswitchactivityisused.The firstbranchisexecutedif a
definedcondition(inside the case branch) ismet.If itis notmet,the otherwise branchisexecuted.
35. 21. Terminate Activity
A terminate activityenablesyoutoendthe tasksof an activity(forexample,the faulthandlingtasksina
catch branch).For example,if aclient'sbadcredithistoryisidentifiedorasocial securitynumberis
identifiedasinvalid,aloanapplicationprocessis terminated,andthe client'sloanapplicationdocument
isneversubmittedtothe service loanproviders.
22. Throw Activity
Thisactivitygeneratesafaultfrominside the businessprocess.
36. 23. Transform Activity
Thisactivityenablesyoutocreate a transformationthatmapssource elementstotargetelements(for
example,incomingpurchase orderdataintooutgoingpurchase orderacknowledgmentdata).
figure showsthe TransformdialoginBPEL1.1. Thisdialogenablesyoutoperformthe followingtasks:
Define the source andtargetvariablesandpartsto map.
Specifythe transformationmapperfile.
Clickthe secondicon(the Addicon) to the rightof the Mapper File fieldtoaccessthe XSLT
Mapper forcreatinga newXSLfile forgraphicallymapping source andtargetelements.Clickthe
Editicon (thirdicon) toeditan existingXSLfile.
In BPEL 2.0, the EmptydialogincludesaDocumentationtabanddoesnotinclude aSkipConditiontab.
Interaction Patterns in BPEL
1. One-WayMessage
In a one-waymessage,orfire andforget,the clientsendsamessage tothe service,andthe service does
not needtoreply.
One-WayMessage
37. BPEL Processas the Client
As the client,the BPELprocessneedsavalidpartnerlinkandan invoke activity withthe targetservice
and the message.Aswithall partneractivities,the WSDLfile definesthe interaction.
BPEL Processas the Service
To accept a message fromthe client,the BPELprocessneedsareceive activity.
2. SynchronousInteraction
In a synchronousinteraction,aclientsendsarequesttoa service,andreceivesanimmediate reply.The
BPEL processcan be at eitherendof thisinteraction,andmustbe codedbasedonitsrole as eitherthe
clientorthe service
BPEL Processas the Client
Whenthe BPEL processison the clientside of asynchronoustransaction,itneedsaninvoke activity.
The port on the clientside bothsendsthe requestandreceivesthe reply.Aswithall partneractivities,
the WSDL file definesthe interaction.
BPEL Processas the Service
Whenthe BPEL processison the service side of asynchronoustransaction,itneedsareceive activityto
accept the incomingrequest,andareplyactivitytoreturneitherthe requestedinformationoran error
message (afault).
3. AsynchronousInteraction
In an asynchronous interaction, a client sends a request to a service and waits until the service replies.
BPEL Process as the Client
38. When the BPEL process is on the client side of an asynchronous transaction, it needs an invoke activity
to send the request and a receive activity to receive the reply. As with all partner activities, the WSDL file
defines the interaction.
BPEL Process as the Service
As with a synchronous transaction, when the BPEL process is on the service side of an asynchronous
transaction, it needs a receive activity to accept the incoming request and an invoke activity to return
either the requested information or a fault.
For each and while – repeatsthe executionof code multiple timesbased onspecifiedcondition.
Adapter
Oracle SOA contains set of Adapters to communicate external sourceslike DB, File, FTP, AQ and JMS etc..
what is Adapter?
Adapterisa designpattern,internallycontainsjavacode tocommunicate external sourceslike DB,File,
FTP,AQ and JMS.
WebService
Database
Database is a permanentlocationtostore ourapplicationdata.itholdsthe data intabularformat. in
general we will donormalizationtostore the data.
what is normalization?
decomposition of schemaintosubschemasiscallednormalization.innormalizationprimaryand
foreignkeyplaysmainrole.we make relationbetweenparentandchildtablesusingPrimaryand
ForeignKey's.
PrimaryKey - thiswe use on parenttable field,itwon'tallow duplicatesandNULL valuestoinsert.
ForeignKey - thiswe use in childtable field.itreferencestoparenttable.
simple example inthe formof Tables.myparentTable isEmpand childtable idDept.
Emp table
No (Primary Key) First Name Last Name Sal
1 Abc Xyz 10000
2 Abc1 Xyz1 20000
3 Abc Xyz2 30000
inthe above table if we tryto insertthe same numberinthe "No" field,itraise primarykeyviolation
exception.
inthe above table if we tryto insert"NULL" inthe "No"field,israise "NULLvaluesnotallowed"
exception.
39. Dept Table
NO (Primary Key) Name Type Emp No(ForeignKey
ReferencesEmpTable
"No" field)
1 A1 A1 1
2 B1 B1 1
3 A1 A1 2
4 A1 A1 3
one parentmay have 0 or manychild's.if we observe "EmpNo"fieldhasduplicate values.
foreignkeyalwaysreferencestoprimarykey,withoutprimarykeythere isnoforeignkey.
SQL ?
it isa querylanguage todo CRUD operationsonTables.CRUDstandsfor Create,Read,Update
and Delete.the followingare the querieswe use todoCRUD operations.
Select*fromEMP - it fetchesall the recordsfromTable.
Select*fromEMP where No=1 - itfetchesrecordsbasedoncondition,withthe "No"fieldvaluesequals
to "1".
InsertintoEMP values() - itinsertsthe datain Table.like we have queriestoUpdate anddelete the
recordsin table.
Procedure in Database?
isusedto execute multipleSQLstatementinasingle request.inprocedure we write multiple
queries.if we execute the procedure,internallyitprocessall the queries.
DB Adapter
The purpose of DB adapterto execute SQLcommandsandprocedures.Ingeneral we needto
write some javacode to execute SQLcommands.Buton behalf Adapterdoingthattask. Justwe needto
provide some configurationlike JNDIname of connectionpool andneedtoprovide SQLoperationwhat
we want to do.
while workingonDBAdapterwe have to focuson followingsteps
Creationof Data Source
Configure DataSource inDB Adapter andUpdate DB Adapter
UsingDB AdapterinApplication.
Creationof Data Source
we needtocreate Data Source inweblogicconsole.loginintoweblogicconsoleusing
credentials(http://localhost:7001/console).
clickon Service ->Data Sources -> New -> GenericData Source
40. enterthe followingproperties
Name : we shouldprovide the name,butitshouldbe yourchoice
JNDIName : we shouldprovide the name,butitshouldbe yourchoice,the followingisthe formatwe
have to maintain,itisnotMandatory, but itis a specificationwe shouldfollow.
jdbc/name onyourchoice
Note : if we provide name as"SOADataSource",itisgoodto provide JNDIname as
"jdbc/SOADataSource"
Database Type : Selectthe Database fromthe listandthenclick"Next"
41. inthisscreenselectDatabase DriverandClickon Next.
we have two differenttypesof Database drivers,XA andnon-XA.thisi will explainlaterwhile explaining
abouttransactionmanagement.
inthisscreen,justClickon Next
In thisscreenwe needtoprovide Database detailslike Database Name,HostName,Port,Database User
Name,Password,andConfirmPasswordandthenClickonNext
43. nextscreenselectthe servertodeploydatasource andclickon finish
above we have createdXA data source.Apart fromXA we have non-XA.XA alwaysparticipate into
transactionmanagement.non-XA neverparticipate intotransactionmanagement.
whatis transaction? - executingsequence of stepsinaprocess.if everythinggoesfinetransactionwill
commit,else rollback.
Configure Data Source in DB Adapter and Update DB Adapter
DB Adapter in
Application
DB adapter
application in
server
Data Source Created
in server
44. Whywe needto configure Data Source in DB Adapter?
if we are usingDB adapterin our application,whenwe runourapplication,DBAdapterinour
applicationcommunicatestoDBAdapteravailable inserver,DBAdaptercommunicatestodatasource
to getthe connection.usingthatconnectionitcommunicatetoDatabase.
followingare the stepstoconfigure DataSource in DB Adapter...
Loginintoweblogicconsole ->Deployments
Thenclickon DbAdapteravailable inlist
ThenSelectConfiguration ->OutboundConnectionPools ->New
46. thenit navigatesthe followingscreen...thenextractthe javax.resource.cci.ConnectionFactory, we found
JNDIname what we createdinpreviousstep
thenclickon JNDIname,we will navigate tofollowingscreen,the default valueinXA DataSource id
empty,we shouldprovide the datasource JNDIname whatwe createdinfirststep.
thenclickon "save".
47. Once Againclickon deployments - > selectDbAdapterCheckBox ->Clickon"Update",itnavigatesto
followingpage.
1
selectthe option"Redeploythisapplicationusingthe followingdeploymentfiles",thenclickon"Next",
innextScreenclickon "Finish".
UsingDB Adapter in Application
we needtodrag and drop intoexternal referenceorexposedservice areaincomposite.while
workingwithDBpollingoptionwe draganddrop inExposedservicesarea,inremainingscenarioswe
place inexternal reference area.
OpenJDeveloperIDEandcreate project(forcreatingprojectinJdeveloper,please followthe document
" Creating Projectin JDeveloper.docx"),Draganddropthe Database Adapterfromservice Adapters
location.
DB Adapterhas manyoptionstoprocesson table like Insert,delete,update,select.Apartfromtable
operationithasmore optionslike DBPolling(Polls onparticularrecordtoprocessnew records),calling
procedure/functionandwe canrun pure SQL.
File and FTP Adapter
purpose of File andFTP adapterto readfromand write to files.file adapterprocessthe filesinwithin
the networkor local system. FTPprocessthe filesinsharedlocationorremote location.whileworking
on File/FTP, we have tofocusonNXSD.
what is NXSD ?
NXSD standsfor native XSD. purpose of NXSDis totransfernative formatdata to XML. In
general we are sendingrequestto service inthe formof XML. But usingfile adapterwe have processthe
flatfileslike bellow
no,name,sal
1, abc, 10000
48. 2, abc1, 20000
3, abc2, 30000
4, abc3, 40000
to convertthiskindof data to XML, we have to use NXSD.
Note : In general we create XSDfiles.Butinthe scenarioof NXSDwe have to generate XSDfilesbased
on some sample files.
listof operations infile Adapter
Read
write
Sync Read
List files
Read- is usedto,read the data fromfile,ithasdifferentproperties,we use those basedonour
requirement.
Write - isusedto, write the contenttofile,ithasdifferentproperties,we use those basedonour
requirement.
Sync Read - isusedto, Readthe data from file , ithas differentproperties,we use those basedonour
requirement.
List files - isusedto,listthe filesindirectory,itgivesusthe informationrelatedtofilesinaselected
folder.
listof operations inFTP adapter
Get
Put
Sync Get
List files
Get - isusedto, readthe data from file locatedinsharedlocation,ithasdifferentproperties,we use
those basedonour requirement.
Put - is usedto,write the contentto file locatedinsharedlocation,ithasdifferentproperties,we use
those basedonour requirement.
Sync Get- is usedto,Readthe data fromfile locatedinsharedlocation,ithasdifferentproperties,we
use those basedonour requirement.
List files - isusedto,listthe filesindirectory,itgivesusthe informationrelatedtofilesinaselected
folder.
difference betweenReadandSync Read?
Readid a pollsonparticularfolderoncertainfolderandprocessfilesavailable.Syncreadondemand
process,afterstartingthe executionwe have toprocessparticularfile,we needtouse SyncRead.
49. Note 1 : same difference applicabletoGetand SyncGet.
PropertiesinFile and FTP adapter - Read and Write Properties
Do not ReadFile content
Use file Streaming
ReadFile as attachment
Directorynamesare Specifiedas
Process filesrecursively
Archive ProcessFiles
Delete filesaftersuccessful retrieval
Name patternsare Specifiedwith
Include fileswithname pattern
exclude fileswithname pattern
FilesContainmultiplemessages
PollingFrequency
MinimumFile Age
Use TriggerFile
AddOutputHeader
Appendtoexistingfile
Do not Read file Content(Read)
You can use the Oracle File andFTPAdaptersas a notificationservice tonotifyaprocesswhenevera
newfile appearsinthe inbounddirectory.Touse thisfeature,selectthe Donot readfile content check
box in the JDeveloperwizardwhile configuringthe "Readoperation."
Read File as attachment (Read)
youcan transferlarge MS Word documents,images,andPDFswithoutprocessingtheircontentwithin
the composite application
Directory names are Specifiedas (all Operation in file Adapter)
it istwotypes
Physical Path
Logical Path
Physical Path - local directory/serverdirectorypath(static)
Logical Path - we will configurepathincomposite.xml,we will readvalue at runtime.
Processfilesrecursively(Read)
we needtoselectthisoptiontoprocessfilesavailable insubdirectories.
Archive Process Files (Read)
Archive the file afterreading,we have tospecifyarchive location.
Delete filesaftersuccessful retrieval (Read)
if we selectthisoption,deletesthe filesafterprocessing.
Name patternsare Specifiedwith (Read)
it hastwo types
file wildcards - *.txt,*.xml,po*.txtlike
50. regularexpression - we will use javaregularexpression - po.*.txt
Include fileswithname pattern (Read)
if we specifyvalue *.txt,itincludesfileswithextinction.txt,we canspecifylike thisalsopo*.txt
exclude fileswithname pattern (Read)
if we specifyvalue *.txt,itexcludesfileswithextinction.txt,we canspecifylikethisalsopo*.txt
FilesContainmultiple messages (Read)
Thisis debauching,batchprocessingof recordsinafile.basedonvalue itprocessrecordsavailable in
file.
PollingFrequency(Read)
it processthe filesavailableinfolderbasedoncertainintervals.we canspecifyintervaltime inseconds,
minutes,Hours,daysandweeks
MinimumFile Age (Read)
If we selectthisoption,Adapterprocessthe files,filesminimumage shouldbe greaterthanequalsthe
specifiedtime.we canspecifytime inseconds,minutes,Hours,daysandweeks
Use Trigger File (Read)
If we use thisoptionAdapterwaitsuntil triggerfile available inspecifiedfolder.simple triggerfile start
the process.
Add Output Header (Write)
if we want to addHeaderinformationinOutputfile
Appendto existingfile (Write)
If we selectthisoption,itappendsthe contenttoexistingfile,elseitwill create new file foreach
processing.
AQ Adapter
Advancedqueuingisthe conceptof Oracle Database.Forthisalsowe needto create Data Source.Data
source creationissame as DB Adapter(ReferDbAdapterDataSource Creation).