Facilitating Rich Data Manipulation in BPEL 
                           using E4X




                          Tammo van ...
The Talk Today

           Motivation and Introduction
           Combining WS‐BPEL with E4X
                     Extensio...
Problem Statement
                     Business Analyst




                     Process Developer




© Tammo van Lessen ...
Low‐level Problems
           BPEL Variables must be initialized              var TShoppingCart shoppingCart
             ...
Alternatives

           BPELJ
                     Use plain old Java snippets
                     Pro: Easy to use
    ...
What is JavaScript/E4X?
           JavaScript
                     ECMA 262, Edition 3
                     JavaScript 1.6...
Using Javascript/E4X in BPEL <assign>

   <assign name=quot;e4x-assignquot;>
       <extensionAssignOperation>
           ...
Using Javascript/E4X in BPEL <extensionActivities>

   <extensionActivity name=“adjustShippingDetailsquot;>
       <js:sni...
Built‐in Functions
           load(…)
                     Loads custom JS/E4X library
           print(…)
               ...
Conclusions
           Variable Assignments in vanilla BPEL are cumbersome
                     Adding items to lists is n...
End of Document
Upcoming SlideShare
Loading in …5
×

Facilitating Rich Data Manipulation in BPEL using E4X

1,444 views

Published on

Talk at ZEUS 2009 about rich data manipulation in BPEL using E4X.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,444
On SlideShare
0
From Embeds
0
Number of Embeds
95
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Facilitating Rich Data Manipulation in BPEL using E4X

  1. 1. Facilitating Rich Data Manipulation in BPEL  using E4X Tammo van Lessen, Jörg Nitzsche, Dimka Karastoyanova Institute of Architecture of Application Systems (IAAS) University of Stuttgart Universitätsstr. 38 70569 Stuttgart Germany tammo.van.lessen@iaas.uni‐stuttgart.de
  2. 2. The Talk Today Motivation and Introduction Combining WS‐BPEL with E4X Extension Assign Operation & Extension Activity Injecting BPEL variables Built‐in functions Conclusions © Tammo van Lessen 2
  3. 3. Problem Statement Business Analyst Process Developer © Tammo van Lessen 3
  4. 4. Low‐level Problems BPEL Variables must be initialized var TShoppingCart shoppingCart var TItem item var EItem eitem Data types are typically not aligned Create  Data mediation required Shopping selectionFailure Cart Array manipulation is cumbersome doXSLTransform AddItem Complete Custom XSL scripts needed Data type  Check Submit Reuse not possible mismatch Availability Order Add to Confirm doXSLTransform Cart © Tammo van Lessen 4
  5. 5. Alternatives BPELJ Use plain old Java snippets Pro: Easy to use Con: W3C DOM still quite cumbersome Semantic Data Mediation SUPER technology Pro: Killer feature on the conceptual level Con: Requires too much modelling efforts <s:mediate inputVariable=quot;xquot; outputVariable=quot;yquot; mediatorIRI=quot;urn:anyquot;? /> © Tammo van Lessen 5
  6. 6. What is JavaScript/E4X? JavaScript ECMA 262, Edition 3 JavaScript 1.6 E4X Proposed by BEA ECMA 357 XML support at the language level Literals, nodes, attributes, namespaces… XPath‐like syntax foreach… Allows nodesets as LHS expressions var items = <items> <item name=quot;SOA bookquot; price=quot;40quot; quantity=quot;2quot;/> <item name=quot;BPM bookquot; price=quot;35quot; quantity=quot;3quot;/> <item name=quot;EAI bookquot; price=quot;30quot; quantity=quot;1quot;/> </items>; alert( items.item.(@name == quot;SOA bookquot;).@quantity ); for each( var thisPrice in items..@price ) { sum += thisPrice; } 6 © Tammo van Lessen
  7. 7. Using Javascript/E4X in BPEL <assign> <assign name=quot;e4x-assignquot;> <extensionAssignOperation> <js:snippet> myVar.TestPart += ' World'; </js:snippet> </extensionAssignOperation> </assign> <assign name=quot;e4x-array-assignquot;> <extensionAssignOperation> <js:snippet> load('shoppingCartUtils.js'); shoppingCart.parameters = createShoppingCartSkeleton(); shoppingCart.parameters.items += createCartItem(item); shoppingCart.parameters.items.item.(@hyped=='true').price *= 2; </js:snippet> </extensionAssignOperation> </assign> BPEL variables are injected into JS context Variables can be read and written 7 © Tammo van Lessen
  8. 8. Using Javascript/E4X in BPEL <extensionActivities> <extensionActivity name=“adjustShippingDetailsquot;> <js:snippet> if (goldRatio > 1.0 || silverRatio > 1.0) { throwFault('urn:myprocess', 'IllegalArgumentFault', 'discount ratios must be <= 1.0'); } if (customer.type == 'gold') { po.items.item.price *= goldRatio; } else if (customer.type == 'silver') { po.items.item.price *= silverRatio; } else if (customer.type == 'besteffort') { po.shippingMode = 'snailmail'; } </js:snippet> </extensionActivity> JavaScript functions can be used to reuse such  snippets Use with caution! 8 © Tammo van Lessen
  9. 9. Built‐in Functions load(…) Loads custom JS/E4X library print(…) Prints debug output to console piid() Returns process instance ID activityName() Returns activity name processName() Returns the process’ QName throwFault(namespace, localpart, faultmsg) throwFault(xmlobject) Throws a BPEL fault validate(…) Validates a variable’s content against its schema 9 © Tammo van Lessen
  10. 10. Conclusions Variable Assignments in vanilla BPEL are cumbersome Adding items to lists is not possible Would require a nodeset as LHS expression Can be done using external XSL scripts Batch‐updating an XPath match is not possible Variable initialization is very verbose No reuse possible for recurring data manipulation tasks. Using E4X in BPEL Provides a convenient syntax for rich XML manipulation Reuse of such scripts across activities and processes is possible Simplifies array manipulation Implementation available Publicly available in Apache ODE Will be part of the upcoming 2.0 release 10 © Tammo van Lessen
  11. 11. End of Document

×