diff options
Diffstat (limited to 'sandbox/travelsample/chapter-06/payment-bpel-contribution/src/main/resources/payment.bpel')
-rw-r--r-- | sandbox/travelsample/chapter-06/payment-bpel-contribution/src/main/resources/payment.bpel | 164 |
1 files changed, 164 insertions, 0 deletions
diff --git a/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/main/resources/payment.bpel b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/main/resources/payment.bpel new file mode 100644 index 0000000000..25c10d43a7 --- /dev/null +++ b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/main/resources/payment.bpel @@ -0,0 +1,164 @@ +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> +<process name="Payment" + targetNamespace="http://www.example.org/Payment" + xmlns="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/" + xmlns:tns="http://tuscany.apache.org/Payment" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:pp="http://www.example.org/Payment/" + xmlns:ccp="http://www.example.org/CreditCardPayment/" + xmlns:eg="http://www.example.org/EmailGateway/" + queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0" + expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"> + + <import location="Payment.wsdl" + importType="http://schemas.xmlsoap.org/wsdl/" + namespace="http://www.example.org/Payment/"/> + + <import location="CreditCardPayment.wsdl" + importType="http://schemas.xmlsoap.org/wsdl/" + namespace="http://www.example.org/CreditCardPayment/"/> + + <import location="EmailGateway.wsdl" + importType="http://schemas.xmlsoap.org/wsdl/" + namespace="http://www.example.org/EmailGateway/"/> + + <partnerLinks> + <partnerLink name="paymentPartnerLink" partnerLinkType="pp:PaymentLinkType" myRole="forward" /> + <partnerLink name="creditCardPaymentPartnerLink" partnerLinkType="ccp:CreditCardPaymentLinkType" partnerRole="forward" initializePartnerRole="yes" /> + <partnerLink name="emailGatewayPartnerLink" partnerLinkType="eg:EmailGatewayLinkType" partnerRole="forward" initializePartnerRole="yes" /> + </partnerLinks> + + <variables> + <variable name="makePaymentRequestMessage" messageType="pp:MakePaymentRequest"/> + <variable name="makePaymentResponseMessage" messageType="pp:MakePaymentResponse"/> + <variable name="authorizeRequestMessage" messageType="ccp:AuthorizeRequest"/> + <variable name="authorizeResponseMessage" messageType="ccp:AuthorizeResponse"/> + <variable name="sendEmailRequestMessage" messageType="eg:SendEmailRequest"/> + <variable name="sendEmailResponseMessage" messageType="eg:SendEmailResponse"/> + </variables> + + <sequence> + <receive name="start" + partnerLink="paymentPartnerLink" + portType="pp:Payment" + operation="makePayment" + variable="makePaymentRequestMessage" + createInstance="yes"/> + + <!-- set up call to payments service --> + <assign name="assign1"> + <copy> + <from> + <literal> + <authorize xmlns="http://www.example.org/CreditCardPayment/"> + <CreditCard xmlns=""> + <CreditCardType>Visa</CreditCardType> + <CreditCardNumber>12345678</CreditCardNumber> + <ExpMonth>2</ExpMonth> + <ExpYear>2010</ExpYear> + <CardOwner> + <Name>Empty</Name> + <Address> + <Street>1 The Road</Street> + <City>Winchester</City> + <State>Hampshire</State> + <ZipCode>AB1 2CD</ZipCode> + <HomePhone>12345678</HomePhone> + </Address> + </CardOwner> + </CreditCard> + <Amount xmlns="">0.0</Amount> + </authorize> + </literal> + </from> + <to>$authorizeRequestMessage.parameters</to> + </copy> + <copy> + <from>$makePaymentRequestMessage.parameters/CustomerId/text()</from> + <to>$authorizeRequestMessage.parameters/CreditCard/CardOwner/Name</to> + </copy> + <copy> + <from>$makePaymentRequestMessage.parameters/Amount/text()</from> + <to>$authorizeRequestMessage.parameters/Amount</to> + </copy> + </assign> + + <invoke name="invokeCreditCardPayment" + operation="authorize" + inputVariable="authorizeRequestMessage" + outputVariable="authorizeResponseMessage" + partnerLink="creditCardPaymentPartnerLink" + portType="ccp:CreditCardPayment" /> + + <!-- set up call to email gateway service --> + <assign name="assign2"> + <copy> + <from> + <literal> + <sendEmail xmlns="http://www.example.org/EmailGateway/"> + <Email xmlns=""> + <To>Default</To> + <Title>Payment Confirmation</Title> + <Body>Your payment has been confirmed</Body> + </Email> + </sendEmail> + </literal> + </from> + <to>$sendEmailRequestMessage.parameters</to> + </copy> + <copy> + <from>$makePaymentRequestMessage.parameters/CustomerId/text()</from> + <to>$sendEmailRequestMessage.parameters/Email/To</to> + </copy> + </assign> + + <!-- call the email gateway to send a confirmation --> + <invoke name="invokeEmailGateway" + operation="sendEmail" + inputVariable="sendEmailRequestMessage" + outputVariable="sendEmailResponseMessage" + partnerLink="emailGatewayPartnerLink" + portType="eg:EmailGateway" /> + + <!-- set up the response --> + <assign name="assign3"> + <copy> + <from> + <literal> + <makePaymentResponse xmlns="http://www.example.org/Payment"> + <Status xmlns="">OK</Status> + </makePaymentResponse> + </literal> + </from> + <to>$makePaymentResponseMessage.parameters</to> + </copy> + </assign> + + + <reply name="end" + partnerLink="paymentPartnerLink" + portType="pp:Payment" + operation="makePayment" + variable="makePaymentResponseMessage"> + </reply> + </sequence> +</process> |