1. Getting Started with Oracle SoA
Oracle SOA Fault Handling in BPEL Process Lab#8
Description:
BISP is committed to provide BEST learning material to the beginners
and advance learners. In the same series, we have prepared a complete
end-to end Hands-on Beginner’s Guide for Oracle SoA. The document
focuses on Fault Handling in a BPEL process. Join our professional training
program and learn from experts.
History:
Version Description Change Author Publish Date
0.1 Initial Draft Shiva Kant Pandey 21st
Nov 2012
0.1 Review#1 Amit Sharma 29th
Nov 2012
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 1
2. Contents
.................................................................................................................................................... 2
Contents....................................................................................................................................... 2
Q) What is fault handling in BPEL process ?..............................................................................3
Business faults: ........................................................................................................................3
Runtime faults: .........................................................................................................................3
Selection failure: Wrong X-Path expression results selection failure fault ...............................4
Create database connection in resource palette : ...................................................................5
Create mds (meta data store ) connection in resource palette :..............................................7
Project on runtime faults:..........................................................................................................9
Topper student project with fault handling (remote fault):......................................................10
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 2
3. Fault Handling in a BPEL process
Q) What is fault handling in BPEL process ?
A) Fault handling allows a BPEL process to handle error messages or exceptions retuned by
outside web services & to generate error messages in response to business or runtime faults.
Business faults:
•Business faults are application -specific faults that are generated within the BPEL process
•These are also called custom faults
•Manufactured by developer
•<catch faultName="ns1:faultName" faultVariable="varName">
Runtime faults:
Runtime faults are the result of problems within the running of the BPEL process
service component or web service .These faults are not user-defined, and are thrown by the
system .
•Binding fault: When server is up & Service is down then this fault is known as binding fault.
•Remote fault: When third party service is down or invocation failed then this fault is known
as remote fault .
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 3
4. Selection failure: Wrong X-Path expression results selection
failure fault .
NOTE : Before going through forward we have to create oracle mds (meta data store) &
database in resource palette & under IDE connections which is located in left pane or (ctrl
+shift+o) .
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 4
5. Create database connection in resource palette :
STEP 1: Use ctrl+shift+o to view Resource Palette on left pane as shown below :
STEP 2: Click on new icon ---> New Connection ----> Database
STEP 3: Edit Database Connection , Fill all required blanks fields as it is filled
in picture shown below
Put radio button on IDE Connections
Connection Name: dev_mds
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 5
6. Connection type : Oracle(JDBC)
Username : dev_mds (as on choice)
Password : welcome1 (as on choice)
click on save password
Driver : thin
Host Name: localhost
JDBC Port : 1521
SID : XE
STEP 4: Click ---> Test Connection & then click OK.
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 6
7. Now successfully Database connection is created in resource palette.
Create mds (meta data store ) connection in resource palette :
STEP 1: Use ctrl+shift+o to view Resource Palette on left pane
STEP 2: Click on new icon ---> New Connection ----> SOA-MDS
STEP 3: Edit SOA-MDS Connection , Fill all required blanks fields as it is filled
in picture shown below
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 7
8. Connection Name : dev mds conn
Connect String : jdbc:oracle:thin:@localhost:1521:XE
Username : DEV_MDS
Username : DEV_MDS
Select MDS partition : soa-infra
STEP 4: Click ---> Test Connection & then click OK.
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 8
9. STEP 5: Now right click icon & select refresh .
Expand IDE connection under Resource Palette & observe that u have successfully created
SOA-MDS .
NOTE : Now as it is a meta data store & so it contains all deployed composites under
dev_mds_conn as shown below .
Project on runtime faults:
Summary :" Runtime faults are the result of problems within the running of the BPEL process
service component or web service & when third party service is down or invocation failed then
fault is known as remote fault .
So in TopperStudentProject TopperStudentService calling third party web service
ProcessStudentService so that this service done all processing & return response to calling
service so for this on shutting down the ProcessStudent composite inside enterprise manager
then it will be unable to reply response & hence calling service i.e TopperStudentService will
error out Remote fault , so our aim is to handle or catch this remote fault or run time fault
through catch activity & reply this fault to the client or consumer of TopperStudentService
also invoke a new third party service i.e StudentFLHService for sending this fault by email
notification to the admin".
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 9
10. Topper student project with fault handling (remote fault):
Step1: Deploy project by clicking TopperStudentProject.
Deployment Finished.
Note: Before Deployment Start Weblogic Admin Server as discussed in my previous document
Oracle Soa Part IV Doc.
Step 2 : Click on Browser icon shown below:
Step 3: Start your enterprise manager by writing url http: //localhost:7001/em/
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 10
11. Note : Here localhost is application server & 7001 is a port in which enterprise manager is
running.
Step 4 : Login using credentials
User Name :weblogic
Password : welcome1
click on login
Step 5: We have successfully login inside Enterprise manager 11g (Farm_dev_soa)
we can clearly observe here that admin server is up & all deployment status is also up it means
that our admin server is running .
Now In left pane of window under Farm_dev_soa click on SOA radio button now again expand
& under default we can easily see all the deployed projects.
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 11
12. Now observe here that status of all composites are up here .
Step 6: Click twice on ProcessStudent on left pane of window.
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 12
13. Step 7: Shut down the composite ProcessStudent & see the confirmation on screen as shown
below:
Step 8: Observe red Arrow pointing down ward means that this composite is shutdown
& also see confirmation below red arrow .
Step 9: Click on Test tab shown below
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 13
14. Step 10: Provide Count number & fill all empty required fields
Step 11: Observe carefully that no field left empty
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 14
15. Step 12: Click on Test Web Service
And get Response shown below:
Step 13: Observe Web service invocation failed warning it means remote fault because third
party service is unable to provide service as process student composite is shut down
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 15
16. Step 14: double click on TopperStudentProject & see that the first instance is created but & its
instance state is completed but faulted & that's why we are unable to get response
since system is faulted & hence there are error messages shown below & click on instance
shown in green box.
Step 15: On clicking instance we come on Fault Trace Window observe here there are four
Faults & all type of instances state are faulted .
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 16
17. Step 16: Click on Flow & see the flow diagram & notice that the invoke process is faulted here
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 17
18. Step 17: Click on Faults & see remote fault Error Message .
So till here we have seen that since ProcessStudent status is down we find error messages as
remote fault & unable to get topper as response .
So from here idea of Fault handling arises i.e how to handle such faults & notify these faults to
admin so that he can agai start the process student composite or up the down server .
Step 18: Create Error.xsd under ProcessStudent /xsd .
•design first Error Elementthen complex type error & elements of complex type of error is
shown below
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 18
19. Step : 19: Make Error element as Errortype.
Step 20: Observe Error.xsd in design mode
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 19
20. Step 21: Since Error xsd is created then open ProcessStudentPhysical location & click xsd
folder
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 20
22. Step 23: Click on refresh & see that we have successfully imported the error .xsd inside
TopperStudentProject .
Step 24: Open StudentList.xsd in design mode & right click on target namespace & click on
import
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 22
23. Step 25: Now Click on source mode
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 23
24. Step 26: Write namespace & schema location of the imported error xsd as shown below:
Step 27:
Register Error xsd namespace inside xsd schema with its prefix "errobj "
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 24
25. Step 28: Click on design mode & see that importing error xsd in StudentList.xsd is complete .
Step 29: Now design two elements inside StudentListResultType & rename first as FaultData .
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 25
26. Step 30:Click on source mode & edit element1
Edit as shown below in red box , here we are referring Error xsd
<xsd:element ref="errobj:Error"/>
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 26
27. Step 31: Click on design mode & see referenced error element
Step 32: Expand Error & observe all sub elements
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 27
28. Step 33:Now see complete StudentList xsd in design mode in which TopperStudentResponse
contains FaultData
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 28
29. Step 34: Open TopperStudentProcess.bpel & click on catch activity to catch remote faults
Step 35: Right Click on Catch Activity & click Edit
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 29
30. Step 36: Click on Browse to select System faults
Step 37: Select remote Fault & click Ok
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 30
31. Step 38: Click Ok
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 31
32. Step 39 : Drag & drop Reply Activity & click twice on it as shown below:
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 32
33. Step 40: Edit Reply as shown below :
Name: ReplyFaultOutput
Interaction Type : Partner Link
Partner Link : TopperStudentService (Browse)
Operation: process
Variable :OutputVariable (create by clicking on + sign)
Click Ok
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 33
34. Step 41: Drag & drop Assign Activity & Rename It as AssignFaultOutput
& then Click it twice :
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 34
35. Step 42: To assign fault output click on expression Drag it Drop it on faultCode as shown
below
Step 43: Write Expression i.e fault code as 'FMW-0001'
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 35
36. Step 44: Similarly severity as 1
Step 45: Select Date Functions & under it select current-date-Time then insert into
Expression
then click ok
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 36
37. Step 46: For Detail click Advanced functions ----> getFaultAs string then
insert into Expression
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 37
38. Step 47: For CompositeName click Advanced functions ----> getCompositeName then
insert into Expression
Step 48: For ComponentName click Advanced functions ----> getComponentName then
insert into Expression
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 38
39. Step 49: For CompositeInstanceId click Advanced functions ----> getCompositeInstanceId then
insert into Expression
Step 50: Observe all assigned values
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 39
40. Step 51 : Assign TopperStudentRequest to RequestPayload since both
are of anonymous type.
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 40
41. Step 52 : Click on compile icon to compile the bpel process
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 41
43. Deployment Finished.
Note: Before Deployment Start Weblogic Admin Server as discussed in my previous document
Oracle Soa Part IV Doc.
Step 54 : Click on Browser icon shown below:
Step 55: Start your enterprise manager by writing url http: //localhost:7001/em/
Note : Here localhost is application server & 7001 is a port in which enterprise manager is
running.
Step 56 : Login using credentials
User Name :weblogic
Password : welcome1
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 43
44. click on login
Step 57: We have successfully login inside Enterprise manager 11g (Farm_dev_soa)
we can clearly observe here that admin server is up & all deployment status is also up it means
that our admin server is running .
Now In left pane of window under Farm_dev_soa click on SOA radio button now again expand
& under default we can easily see all the deployed projects.
Click twice on TopperStudentProject .
Step 58: Click on TEST & create instance
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 44
46. Step 60: Scroll down page & Provide required input of a students
Step 61: Click on Test Web Service
And get Response shown below:
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 46
47. Step 62: Explore topper student & find all blank spaces due to fault so explore FaultData
Step 63: Now we can see that catch activity catch the fault & replied to the client as
Faultdata Response .
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 47