What Happens When You Create an Exit Activity

11-46 Oracle Fusion Middleware Developers Guide for Oracle SOA Suite Example 11–34 Invoke Activity scope faultHandlers catch faultName=services:NegativeCredit faultVariable=crError empty catch faultHandlers sequence invoke name=invokeCR partnerLink=creditRatingService portType=services:CreditRatingService operation=process inputVariable=crInput outputVariable=crOutput bpelx:postAssert name=negativeCredit expression=crOutput.payloadtns:rating 0 faultName=services:NegativeCredit message=Negative Credit invoke sequence scope The optional name attribute for bpelx:preAssert or bpelx:postAssert is used while creating the audit trail event message. The name in this instance enables you to identify the assertion element in case multiple assertions are specified. If no name attribute is specified, the line number of the assertion element in the BPEL file may be used.

11.14.1 bpelx:postAssert and bpelx:preAssert Extensions

Depending upon the activity, you can specify when to execute a condition by clicking the Add icon in the Assertions tab of invoke, receive, reply, and onMessage branches of pick and scope activities, and selecting either Pre Assert or Post Assert. Based on your selection, the following bpelx extensions are used: ■ bpelx:preAssert: If you select Pre Assert, the condition is executed before the invoke or reply activity send out the outbound message. ■ bpelx:postAssert: If you select Post Assert, the condition is executed after an invoke activity, receive activity, or onMessage branch receives the inbound message. Example 11–35 shows multiple bpelx:postAssert extensions in a receive activity: Example 11–35 bpelx:postAssert Extension in a Receive Activity receive name=Receive_1 createInstance=no variable=Receive_1_processResponse_InputVariable partnerLink=AsyncBPELService portType=ns1:AsyncBPELServiceCallback bpelx:for=PT10S operation=processResponse bpelx:postAssert name=assert1 expression=true message=assert true failed faultName=client:fault1 bpelx:postAssert name=assert2 expression=false message=assert false failed faultName=client:fault2 receive Example 11–36 shows multiple bpelx:preAssert extensions in an invoke activity: Example 11–36 bpelx:preAssert Extension in a Invoke Activity invoke name=Invoke_1 inputVariable=Invoke_1_process_InputVariable Using Fault Handling in a BPEL Process 11-47 outputVariable=Receive_1_processResponse_InputVariable partnerLink=SyncBPELService portType=ns1:SyncBPELService operation=process bpelx:preAssert name=assert1 expression=true message=assert true failed bpelx:preAssert name=assert2 expression=bpws:getVariableDatacounter = 3 message=concatThe value of counter is , counter For information on using the Assertions tab, see Section 11.14.8, How to Create Assertion Conditions.

11.14.2 Use of faultName and message Attributes

You can specify the faultName and message attributes of the bpelx:postAssert element, as shown in Example 11–37 . Example 11–37 faultName and message Attributes invoke | receive | onMessage standard-elements bpelx:postAssert name=ncname? expression=boolean-expr faultName=QName+ message=generic-expr+ invoke | receive | onMessage If you do not specify the faultName attribute, the fault defaults to bpelx:postAssertFailure. If the message attribute is not specified, the message value defaults to the name of the activity. bpelx:postAssert expression=boolean-expr The specified fault is thrown whenever the assertion condition evaluates to false. Analysis is performed on the faultName QName to ensure that it properly resolves to a fault that has been defined in the partner WSDL portType. The message expression is a general expression that can evaluate to any XPath value type string, number, or boolean. If a nonstring value is returned, the string equivalent of the value is used.

11.14.3 Multiple Assertions

You can nest multiple assertions in receive activities, invoke activities, and the onMessage branch of pick and scope activities, with evaluation of the assertions continuing in the order in which they were declared until an expression evaluates to false. Example 11–38 provides details. Example 11–38 Nesting Multiple Assertions invoke name=invokeCR partnerLink=creditRatingService portType=services:CreditRatingService operation=process inputVariable=crInput outputVariable=crOutput bpelx:postAssert name=negativeCredit expression=crOutput.payloadtns:rating faultName=services:NegativeCredit message=Negative Credit bpelx:postAssert name=insufficientCredit expression=crOutput.payloadtns:rating 600 faultName=services:InsufficientCredit message=Insufficient Credit invoke