Hi Sathwik, Thanks for your input.
I dug through ODE's source code and came to the same conclusion that uninitialized variable resolution causes the fault and there was no way around it. I opted to track variable initialization using a second boolean variable. The tracking variable gets initialized to false at the beginning. In any condition that references the potentially uninitialized variable I must first check the tracking variable is true. If it is not true, the condition is short-circuited and the uninitialized variable is not accessed. The WS-BPEL code is generated programmatically and this approach produces small changes on the outputted code. I'm happy with it. - Stan On 10 March 2016 at 20:41, Sathwik B P <[email protected]> wrote: > Hi Stan, > > In case you haven't found an answer. > > The variable resolution happens even before the function call. So if the > variable is uninitialized a fault will be throw by the engine as per the > BPEL specification. > > ODE has some extensions to bypass the evaluation of expressions that result > in these faults: https://ode.apache.org/extensions/flexible-assigns.html > > Or, another approach could be to define the activity that references the > variable within a Scope activity and have a fault handler within that scope > that catches the specific fault, that way you can decide the next course of > action. > > Or, if possible initialize the variable atleast with the root element and > then use the exist(expr) or boolean(expr) xpath functions. > > regards, > sathwik > > On Thu, Mar 3, 2016 at 5:56 PM, Stan Angeloff <[email protected]> > wrote: > > > Hi all, > > > > I am running into a case where I need to check if a variable has been > > initialized in a *<bpel:condition />*. The variable is first defined > inside > > *<bpel:variables>* without inline initialization. The following condition > > is then added to a *<bpel:repeatUntil>*: > > > > ($variableIf_2Out.parameters/getStatusResult/status = 'CLICKED') > > > > However *$variableIf_2Out* may not have been initialized as the > > *<bpel:invoke>* activity that outputs it is conditional and may not have > > been encountered yet. > > > > I tried with: > > > > (exists($variableIf_2Out) and > > $variableIf_2Out.parameters/getStatusResult/status = 'CLICKED') > > > > but that didn't seem to help (the expression language is set to > > *"urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"*). > > > > In a desperate attempt I tried: > > > > (exists(bpel:getVariableData('variableIf_2Out', 'parameters')) and > > $variableIf_2Out.parameters/getStatusResult/status = 'CLICKED') > > > > and even: > > > > <bpel:condition xmlns:bpws=" > > http://schemas.xmlsoap.org/ws/2004/03/business-process/"> > > (exists(bpws:getVariableData('variableIf_2Out', 'parameters')) and > > $variableIf_2Out.parameters/getStatusResult/status = 'CLICKED') > > </bpel:condition> > > > > That didn't get me anywhere either (according to the logs the function is > > not defined or arguments cannot be matched). > > > > Is there a way in ODE by which a variable can be checked to have been > > initialized? > > > > Thanks, > > - Stan > > >
