Wednesday, December 14, 2011

BPEL - Extensions


Introduction


WS-BPEL 2.0 supports custom variable assignment mechanisms (Extensible Assign Operations) and user-defined activities (Extension Activities). To use these features, WS-BPEL provides two explicit extension constructs <extensionAssignOperation> and <extensionActivity>.

In order to use BPEL extensions, Extensions must be declared in the BPEL process model. It tells to the BPEL engine which extensions must be available and which are optional. Extension declaration can be done by adding an <extension …> element to the BPEL process model as follows.

<bpel:process...>
            <bpel:extensions>
            <bpel:extension namespace="#extension-namespace#"
                        mustUnderstand="#yes|no#"/>
<bpel:extension namespace="#another-extension-namespace#"
                        mustUnderstand="#yes|no#"/>     
            </bpel:extensions>
 ...
</bpel:process>

Extensible Assign Operations

Extensible Assign Operation allows including extensible data manipulation operations defined as extension elements under namespaces different from the WS-BPEL namespace. If the element contained within the extensionAssignOperation element is not recognized by the BPEL engine and is not subject to a mustUnderstand="yes" requirement from an extension declaration then the extensionAssignOperation operation MUST be ignored.


It is structured as follows.

<bpel:process...>
            <bpel:sequence>
...
<assign validate="yes|no"? standard-attributes>
            standard-elements
            <extensionAssignOperation>
                        assign-element-of-other-namespace
            </extensionAssignOperation>
</assign>
</bpel:sequence>
 ...
</bpel:process>


E4X expressions can be used in Extensible Assign Operations. Following code snippet will show you how to define an ExtensionAssignOperation using E4X expressions..

<bpel:assign name="AssignE4X">
<bpel:extensionAssignOperation>
<js:snippet xmlns:js="http://ode.apache.org/extensions/e4x">
E4X-expressions
</js:snippet>
</bpel:extensionAssignOperation>
</bpel:assign>

The snippet element declares the given extension namespace and it contains the E4X expressions.

Extension Activity

extensionActivity is a mechanism defined in WS-BPEL 2.0, that allows to define new activities, which are not defined by WS-BPEL 2.0 specification.  You can define new activity by placing them inside the <extensionActivity> element.

According to the Specification <extensionActivity> should have a single element, which is qualified with a namespace different from WS-BPEL namespace.  If the element contained within the <extensionActivity> element is not recognized by the WS-BPEL processor and is not subject to a mustUnderstand="yes" requirement from an extension declaration then the unknown activity MUST be treated as if it were an <empty> activity that has the standard-attributes and standard-elements of the unrecognized element; all its other attributes and child elements are ignored.  

(Read full BPEL specification about ExtensionActivity)

ExtenisionActivity structured as follows,

<bpel:process...>
            <bpel:sequence>
...
<extensionActivity>
<anyElementQName standard-attributes>
standard-elements
</anyElementQName>
</extensionActivity>
</bpel:sequence>
 ...
</bpel:process>


No comments:

Post a Comment