Getting Started with Oracle SoA Oracle SOA Working with Custom Faults Lab#9 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 Working with Custom Faults. Join our professional training program and learn from experts. History: Version Description Change Author Publish Date 0.1 Initial Draft Shiva Kant Pandey 21 st Aug 2012 0.1 Review#1 Amit Sharma 29 th Aug 2012 www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 1
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Getting Started with Oracle SoA
Oracle SOA Working with Custom Faults Lab#9
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 Working with Custom Faults. Join our professional training program and learn from experts.
History:Version Description Change Author Publish Date0.1 Initial Draft Shiva Kant Pandey 21st Aug 20120.1 Review#1 Amit Sharma 29th Aug 2012
Working with Custom faults Q)What are custom faults ?
A) Custom faults are those faults which is defined by developer for certain limitations .
Summary: Aim of custom fault project is that to catch those faults which are defined by developer at the time of service development so here in topper student project when someone input wrong student marks i.e input marks of individual subject should not be smaller than zero & greater than hundred , so this kind of restrictions are provided by developer so if wrong marks input then it shows custom fault message that input marks is invalid .
Step wise procedure on topper student project with fault handling (custom fault):
Step 1: Open ProcessStudent Project & under it open ProcessStudentProcess.bpel as shown below
Step 2: In design mode Drag & Drop Switch Activity so that bpel can set condition
Step 3: Click on condition part to set if condition for switch activity
Motive of Switch ActivityOur motive is setting condition that if marks are smaller than zero or greater than hundred then throw custom/business fault & also reply this fault as output else choose otherwise condition if input marks are correct & keep all components inside this otherwise condition
Step 5: Click on lang1 marks ---> insert into expression ---> Logical Function ----> smaller ---> insert into expression ---> 0 (zero) or Click on lang1 marks ---> insert into expression ---> Logical Function ----> greater ---> insert into expression ---> 100 (hundred) or Click on lang2 marks ---> insert into expression ---> Logical Function ----> smaller ---> insert into expression ---> 0 (zero) or Click on lang2 marks ---> insert into expression ---> Logical Function ----> greater ---> insert into expression ---> 100 (hundred) or Click on lang3marks ---> insert into expression ---> Logical Function ----> smaller ---> insert into expression ---> 0 (zero) or Click on lang3 marks ---> insert into expression ---> Logical Function ----> greater ---> insert into expression ---> 100 (hundred) as shown below
Step 10: Double Click On Throw activity & Edit Throw activity , Click On Browse icon shown below
Step 11: Observe that there is no fault message under Project WSDL Files in ProcessStudentProcess.wsdl so first create fault message inside ProcessStudent wsdl file for custom fault .
Step 12: Observe ProcessStudentProcess.wsdl in design mode that inside port type it has only two process one is Input & other output but not containing Fault as its third process so create it in source mode .
Step16: Import Error.xsd from oramds , open resource palette ---> SOA-MDS-->dev mds conn -->apps--->Error.xsd
to get schema location of error.xsd click once on it & use ctrl +shift+c then paste inside schemalocation , delete all before apps & write oramds:/ before apps . then copy namespace from error.xsd & paste here inside namespace .
Step 26: Check that all QName is associated with its prefix , so observe here that InvalidStudentMarksFaultVar does not contains its prefix so click on QName & edit variable , it should be message type , click on Browse
Note : Here localhost is application server & 7001 is a port in which enterprise manager is running.
Step 46 : Login using credentials User Name :weblogicPassword : welcome1click on login
Step 47: 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 on Processstudent twice
Step 55: All instances are completed & instance 320002 is completed with custom fault & instance 320003 is completed without errors .
NOTE: Now how we catch these faults through invoking service , next steps are concentrated on this question in which calling service is TopperStudent Service .
Step 56: Open Topper Student Process . bpel click on Add catch all activity shown below
Scope Activity : This activity consists of a collection of activities that can have their own local variables , fault handlers, compensation handlers and so on . A scope activity is analogous to a block { } in programming language .Each scope has a primary activity can be complex structured activity that, with many nested activities within it to arbitrary depth. The scope is shared by all the nested activities .
Step 62: Now drag & drop all components inside scope activity as shown below :
NOTE: Since we have made changes in ProcessStudentProcess.wsdl in ProcessStudentProject hence also need changes in imported ProcessStudentProcess.wsdl in TopperStudent Project so that catch activity catch this custom fault as remote fault in TopperStudentProject .
Step 63: Open ProcessStudentProcess.wsdl in TopperStudentProject by clicking on it & observe in design mode that it does not have fault process .
Aim : Our aim is to copy the required content from 'M wsdl ' to 'N wsdl'
Where M= 'ProcessStudentProcess.wsdl' in ProcessStudent Project
& N= ' 'ProcessStudentProcess.wsdl' in TopperStudentProject
Step 64: Copy imported Error.xsd from M.wsdl as shown below:
Note : Here localhost is application server & 7001 is a port in which enterprise manager is running.
Step 79 : Login using credentials User Name :weblogicPassword : welcome1click on login
Step 80: 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 85: Now we can see that catch activity catch the fault & replied to the client as Faultdata Response but here catch activity cached it as remote fault thats why fault code is FMW-0001 & detail of custom fault is displayed inside Detail as FMW-002 , <Detail>Invalid marks </Detail> as shown below :