You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ode.apache.org by "Jackson, Douglas" <dj...@ugs.com> on 2006/11/10 23:12:52 UTC

BPEL question

Hi!

I have a BPEL question that is not specific to ode.

 

If I have an xml element or message in a variable, and it has an
optional field:

 

<xsd:element name="xxx" xmlns="http://xxxns">

    <xsd:complexType>

        <xsd:sequence>

             <xsd:element name="yyy" type="xsd:string" minOccurs="0"/>

        </xsd:sequence>

    </xsd:complexType>

</xsd:element>

 

and in my BPEL process I want to find out if that field is present in
that element, then

how would I write the BPEL:

 

 <switch xmlns:xxx="http://xxxns">

     <case condition="bpelx:getVariableData('xxx-msg', 'xxx-part',
'/xxx:xxx/yyy') ???">

          do something...

 </switch>

 

Won't the xpath for the query above fail since the yyy element is not
there?

 

Thanks in advance,

-Doug.

 


Re: BPEL question

Posted by Assaf Arkin <ar...@intalio.com>.
That's one of the reasons I recommend switching to BPEL 2.0.

It's an oversight of the spec that getVariableData throws a fault in *all*
conditions, that should be limited to the message part not being
initialized, BPEL 2.0 makes that restriction in the syntax.

These two should have been equivalent:
  bpelx:getVariableData('xxx-msg', 'xxx-part')/xxx:xxx/yyy
  bpelx:getVariableData('xxx-msg', 'xxx-part','/xxx:xxx/yyy')

Assaf


On 11/13/06, Jackson, Douglas <dj...@ugs.com> wrote:
>
>
> Hi Assaf!
>
> According to the BPEL Spec (1.1) for bpws:getVariableData
> ('variableName', 'partName'?, 'locationPath'?):
>
> "If the given locationPath selects a node set of a size other than one
> during execution, then the standard fault bpws:selectionFailure MUST be
> thrown by a compliant implementation."
> Since yyy does not exist wouldn't it cause an exception?
>
> This seems to contradict your assertion that it should evaluate to
> false.
> -Doug.
>
> -----Original Message-----
> From: Assaf Arkin [mailto:arkin@intalio.com]
> Sent: Friday, November 10, 2006 4:57 PM
> To: ode-user@incubator.apache.org
> Subject: Re: BPEL question
>
> On 11/10/06, Jackson, Douglas <dj...@ugs.com> wrote:
> >
> >
> > <switch xmlns:xxx="http://xxxns">
> >
> >      <case condition="bpelx:getVariableData('xxx-msg', 'xxx-part',
> > '/xxx:xxx/yyy') ???">
> >
> >           do something...
> >
> > </switch>
> >
> >
> >
> > Won't the xpath for the query above fail since the yyy element is not
> > there?
>
>
> Doug,
>
> An XPath expression can be asked to return a node set, boolean, integer
> or
> string. In this case, the XPath expression is expected to return a
> boolean
> value. For an expression like this, the value is true if there's one or
> more
> nodes, zero if no node can be selected.
>
> Assaf
>
>
> Thanks in advance,
> >
> > -Doug.
> >
> >
> >
> >
> >
>



-- 
CTO, Intalio
http://www.intalio.com

RE: BPEL question

Posted by "Jackson, Douglas" <dj...@ugs.com>.
Hi Assaf!

According to the BPEL Spec (1.1) for bpws:getVariableData
('variableName', 'partName'?, 'locationPath'?):

"If the given locationPath selects a node set of a size other than one
during execution, then the standard fault bpws:selectionFailure MUST be
thrown by a compliant implementation."
Since yyy does not exist wouldn't it cause an exception?

This seems to contradict your assertion that it should evaluate to
false.
-Doug.

-----Original Message-----
From: Assaf Arkin [mailto:arkin@intalio.com] 
Sent: Friday, November 10, 2006 4:57 PM
To: ode-user@incubator.apache.org
Subject: Re: BPEL question

On 11/10/06, Jackson, Douglas <dj...@ugs.com> wrote:
>
>
> <switch xmlns:xxx="http://xxxns">
>
>      <case condition="bpelx:getVariableData('xxx-msg', 'xxx-part',
> '/xxx:xxx/yyy') ???">
>
>           do something...
>
> </switch>
>
>
>
> Won't the xpath for the query above fail since the yyy element is not
> there?


Doug,

An XPath expression can be asked to return a node set, boolean, integer
or
string. In this case, the XPath expression is expected to return a
boolean
value. For an expression like this, the value is true if there's one or
more
nodes, zero if no node can be selected.

Assaf


Thanks in advance,
>
> -Doug.
>
>
>
>
>

Re: BPEL question

Posted by Assaf Arkin <ar...@intalio.com>.
On 11/10/06, Jackson, Douglas <dj...@ugs.com> wrote:
>
>
> <switch xmlns:xxx="http://xxxns">
>
>      <case condition="bpelx:getVariableData('xxx-msg', 'xxx-part',
> '/xxx:xxx/yyy') ???">
>
>           do something...
>
> </switch>
>
>
>
> Won't the xpath for the query above fail since the yyy element is not
> there?


Doug,

An XPath expression can be asked to return a node set, boolean, integer or
string. In this case, the XPath expression is expected to return a boolean
value. For an expression like this, the value is true if there's one or more
nodes, zero if no node can be selected.

Assaf


Thanks in advance,
>
> -Doug.
>
>
>
>
>