Upload
amit-sharma
View
330
Download
0
Tags:
Embed Size (px)
Citation preview
Getting Started with Oracle SoA
Fault Handing in BPEL Process Lab#7
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 various fault handling techniques in BPEL process. Join our professional training program and learn from experts.
History:Version Description Change Author Publish Date0.1 Initial Draft Shiva Kant Pandey 21st Sep 20120.1 Review#1 Amit Sharma 29th Sep 2012
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 1
ContentsContents....................................................................................................................................... 2
Fault Handling in BPEL Process ...................................................................................................3
BUSINESS FAULTS: ................................................................................................................... 3
RUNTIME FAULTS : ....................................................................................................................3
Creating database connection in resource palette ..................................................................4
Create mds (meta data store ) connection in resource palette :..............................................6
Project on runtime faults:........................................................................................................10
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 2
Fault Handling in BPEL Process 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 processservice 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
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) .
Creating 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
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 4
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 5
STEP 3: Edit Database Connection , Fill all required blanks fields as it is filled
in picture shown below
STEP 4: Click ---> Test Connection & then click OK.
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
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 6
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
STEP 4: Click ---> Test Connection & then click OK.
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 .
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 8
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 9
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".
Step w ise procedure of project on topper student project with fault handling (remote fault):
Step1: Deploy project by clicking TopperStudentProject.
Deployment Finished.
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 10
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/
Note : Here localhost is application server & 7001 is a port in which enterprise manager is running.
Step 4 : Login using credentials User Name :weblogicPassword : welcome1click on login
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 11
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.
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
Step 7: Shut down the composite ProcessStudent & see the confirmation on screen as shown below:
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 13
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
Step 10: Provide Count number & fill all empty required fields
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 14
Step 11: Observe carefully that no field left empty
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
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 rare unable to get response
since system is faulted & hence there are error messages shown below & click on instance shown in green box.
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 16
Step 15: On clicking instance we come on Fault Trace Window observe here there are four Faults & all type of instances state are faulted .
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
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 Element then complex type error & elements of complex type of error is shown below
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 18
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
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
Step 22: Copy Error.xsd file from ProcessStudent & paste inside physical location of TopperStudentProject--->xsd folder
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 21
Step 23: Click on refresh & see that we have successfully imported the error .xsd inside TopperStudentProject .
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 22
Step 24: Open StudentList.xsd in design mode & right click on target namespace & click on import
Step 25: Now Click on source mode
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 23
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
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
Step 30:Click on source mode & edit element1
Edit as shown below in red box , here we are referring Error xsd
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 26
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
Step 33:Now see complete StudentList xsd in design mode in which TopperStudentResponse contains FaultData
Step 34: Open TopperStudentProcess.bpel & click on catch activity to catch remote faults
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 28
Step 35: Right Click on Catch Activity & click Edit
Step 36: Click on Browse to select System faults
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 29
Step 37: Select remote Fault & click Ok
Step 38: Click Ok
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 30
Step 39 : Drag & drop Reply Activity & click twice on it as shown below:
Step 40: Edit Reply as shown below :
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 31
Step 41: Drag & drop Assign Activity & Rename It as AssignFaultOutput & then Click it twice :
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 32
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 33
Step 44: Similarly severity as 1
Step 45: Select Date Functions & under it select current-date-Time then insert into Expressionthen click ok
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 34
Step 46: For Detail click Advanced functions ----> getFaultAs string then insert into Expression
Step 47: For CompositeName click Advanced functions ----> getCompositenName then insert into Expression
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 35
Step 48: For ComponentName click Advanced functions ----> getComponentName then insert into Expression
Step 49: For CompositeInstanceId click Advanced functions ----> getCompositeInstanceId then insert into Expression
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 36
Step 50: Observe all assigned values
Step 51 : Assign TopperStudentRequest to RequestPayload since both are of anonymous type.
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 37
Step 52 : Click on compile icon to compile the bpel process
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 38
Step 53: 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 54 : Click on Browser icon shown below:
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 39
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 :weblogicPassword : welcome1click on login
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 40
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 41
Step 59: Input Student array size =2
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 42
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 43
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 44
Step 64 : Now Logout enterprise manager & stop weblogic admin server .
www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 45