What Happens After You Create a Scope Activity
The following example shows the scope activity in the .bpel
file after design completion. The Scope_AuthorizeCreditCard
scope activity consists of activities that perform the following actions:
-
A catch activity for catching faulted orders in which the credit card number is not provided or the credit type is not valid.
-
A throw activity that throws a fault for orders that are not approved.
-
An assign activity that takes the credit card type, credit card number, and purchase amount, and assigns this information to the input variable for the
CreditCardAuthorizationService
service. -
An invoke activity that calls a
CreditCardAuthorizationService
service to retrieve customer information. -
A switch activity that checks the results of the credit card validation.
<scope name="Scope_AuthorizeCreditCard"> <variables> <variable name="lCreditCardInput" messageType="ns2:CreditAuthorizationRequestMessage"/> <variable name="lCreditCardOutput" messageType="ns2:CreditAuthorizationResponseMessage"/> </variables> <faultHandlers> <catch faultName="bpws:selectionFailure"> <sequence> <assign name="Assign_noCCNumber"> <copy> <from expression="string('CreditCardCheck - NO CreditCard')"/> <to variable="gOrderProcessorFaultVariable" part="code"/> </copy> </assign> <throw name ="Throw_NoCreditCard" faultVariable="gOrderProcessorFaultVariable" faultName="ns9:OrderProcessingFault"/> </sequence> </catch> <catch faultName="ns2:InvalidCredit"> <sequence> <assign name="Assign_InvalidCreditFault"> <copy> <from expression="concat(bpws:getVariableData ('gOrderInfoVariable','/ns4:orderInfoVOSDO/ ns4:CardTypeCode'), ' is not a valid creditcard type')"/> <to variable="gOrderProcessorFaultVariable" part="summary"/> </copy> <copy> <from expression="string('CreditCardCheck - NOT VALID')"/> <to variable="gOrderProcessorFaultVariable" part="code"/> </copy> </assign> <throw name="Throw_OrderProcessingFault" faultName="ns9:OrderProcessingFault" faultVariable="gOrderProcessorFaultVariable"/> </sequence> </catch> </faultHandlers> <sequence> <assign name="Assign_CreditCheckInput"> <copy> <from variable="gOrderInfoVariable" query="/ns4:orderInfoVOSDO/ns4:OrderTotal"/> <to variable="lCreditCardInput" part="Authorization" query="/ns8:AuthInformation/ns8:PurchaseAmount"/> </copy> <copy> <from variable="gOrderInfoVariable" query="/ns4:orderInfoVOSDO/ns4:CardTypeCode"/> <to variable="lCreditCardInput" part="Authorization" query="/ns8:AuthInformation/ns8:CCType"/> </copy> <copy> <from variable="gOrderInfoVariable" query="/ns4:orderInfoVOSDO/ns4:AccountNumber"/> <to variable="lCreditCardInput" part="Authorization" query="/ns8:AuthInformation/ns8:CCNumber"/> </copy> </assign> <invoke name="InvokeCheckCreditCard" inputVariable="lCreditCardInput" outputVariable="lCreditCardOutput" partnerLink="CreditCardAuthorizationService" portType="ns2:CreditAuthorizationPort" operation="AuthorizeCredit"/> <switch name="Switch_EvaluateCCResult"> <case condition="bpws:getVariableData('lCreditCardOutput','status',' /ns8:status') != 'APPROVED'"> <bpelx:annotation> <bpelx:pattern>status <> approved</bpelx:pattern> </bpelx:annotation> <throw name="Throw_Fault_CC_Denied" faultName="client:OrderProcessorFault"/> </case> /switch> </sequence> </scope>