Here's another example with a few more stuff, it also demonstrates an XML literal. I have to work on inlined function declaration when it's used only once in a process, it should make it even shorter but that's already not too bad.
namespace sref=" http://docs.oasis-open.org/wsbpel/2.0/serviceref"; namespace addr="http://example.com/addressing"; # Correlation functions function auctionIdFromAnswer(answer) { answer.auctionId; } function auctionIdFromBuyer(buyer) { buyer.ID; } function auctionIdFromSeller(seller) { seller.auctionId; } # Auction process as defined in chapter 15.4 of the BPEL 2.0 specification process Auction { partnerLink buyerOrSeller, auctionRegistrar, seller; var auctionId unique, buyerData, sellerData; # The original BPEL spec example for the auctions process uses a join pattern which # we chose to not support in SimPEL. This is equivalent. receive(buyerOrSeller, submit) { |startData| if (startData.buyer) { buyerData = startData; auctionId = auctionIdFromBuyer(buyerData); sellerData = receive(seller, submit, {auctionIdFromSeller: auctionId}); } else { sellerData = startData; auctionId = auctionIdFromSeller(sellerData); buyerData = receive(buyer, submit, {auctionIdFromBuyer: auctionId}); } } # The endpoint hardcoded in the process is kind of evil but heck, that's the example. auctionRegistrar = <sref:service-ref> <addr:EndpointReference> <addr:Address> http://example.com/auction/RegistrationService/</addr:Address> <addr:ServiceName>as:RegistrationService</addr:ServiceName> </addr:EndpointReference> </sref:service-ref>; auctionData.auctionHouseEPR = auctionRegistrar.myRole; auctionData.auctionId = sellerData.auctionId; auctionData.amount = 1; invoke(actionRegistrar, processData, auctionData); answerData = receive(actionRegistrar, answer, {auctionIdFromAnswer: auctionId}); parrallel { seller = sellerData.endpointReference; sellerAnswerData.thankYouText = "Thank you!"; invoke(seller, answer, sellerAnswerData); } and { buyer = buyerData.endpointReference; buyerAnswerData.thankYouText = "Thank you!"; invoke(buyer, answer, sellerAnswerData); } } Matthieu On Dec 18, 2007 12:12 PM, Alex Boisvert <[EMAIL PROTECTED]> wrote: > In case you missed it, Matthieu just added a SimPEL version of the BPEL > spec's Loan Approval process. > > > http://svn.apache.org/viewvc/ode/sandbox/simpel/src/test/resources/loan-approval.simpel?revision=605313 > > Much nicer than 3-4 pages of xml-goobleygook. > > :) > alex > > Disclaimer: These are just test cases for the parser. SimPEL doesn't > execute yet. >
