Assign Activity Little Deeper
Lets talk more about assign activity, with the inversion of BPEL 2.0, it came with a lot of changes. Also during our project, we simply use assign activity for simple assignment of variables or data.
There are the option available with the assign activity.
1. Removing a node.
2. Assign with no target and no assignment.
3. Assign with XML
4. Rename ore recast the Node.
we are very much using very simple functions of the assign activities. Lets explore a little more. Download the example given and run. Give any generic input to the request and then see what it is doing.
1.Removing a node.
Open the scope ScopeRemoveElement and see this, we have just place the x from the upper right corner to the input schema. It will simply remove the element from the payload.
2. Assign with missing no target of source node
Now this is a new addition of BPEL 2.0, In BPEL 1.0, while BPEL 1.0 throws exceptions if there is source or target node missing. In BPEL 2.0 this option prevent the run-time exception of source or target missing.
You can use this option if you think sometime source or target node may not be there and you are not worried about that data.
3. Assign with XML
This is very lest used option but you can assign a complete xml to a variable, Obviously the namespace of the xml and target should match.
Example: Open assignCompleteNode Scope and see the assign activity inside it.
4. Rename ore recast the Node.
Now if we want to rename a single node to any other type then you can use this option for the renaming.
Recasting is almost like if we want string to recast to the integer or some other type.
Open the last Assign Activity and see how its been done, we have created both the example assign and recast.
Running
Open each assign to see the behavior.
Download
Please use the link to download the application.
Exercise
1. Remove the status from target node.
2. Change employId output to string.
Please let us know your suggestions, we will happy to incorporate your views and details.
Helpful! Thanks!
ReplyDelete