ode-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sathwik B P <sathwik...@gmail.com>
Subject Re: How to check if a variable has been initialized?
Date Thu, 10 Mar 2016 18:41:15 GMT
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 <stanimir@angeloff.name>
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
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message