ode-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Coogan <Jonathan.Coo...@attachmate.com>
Subject Re: using foreach counter
Date Mon, 17 Nov 2008 20:54:40 GMT
Thank you.  See ODE-426.

Here's another oddity I just noticed (not related to foreeach)..

Say I have a process that takes a single string as input and returns a
single integer as output.  All I want to do is convert the input string to a
number and add 10 to it, then return the result as an integer.

No matter what I do, I cannot get the process to return a true integer.  It
always tacks a .0 on the end.  For example, with input "10" it returns 10.0.
For input "999" it returns 999.0.



Here's my wsdl..

...
<types>
    <schema ...>
        <element name="TestXPathIntegersRequest" type="string" />
        <element name="TestXPathIntegersResponse" type="integer" />
    </schema>
</types>
<message name="TestXPathIntegersRequestMessage">
    <part name="payload" element="tns:TestXPathIntegersRequest"/>
</message>
<message name="TestXPathIntegersResponseMessage">
    <part name="payload" element="tns:TestXPathIntegersResponse"/>
</message>
...

And here's my bpel...

...
<bpws:variables>
    <bpws:variable messageType="tns:TestXPathIntegersRequestMessage"
name="input"/>
    <bpws:variable
messageType="tns:TestXPathIntegersResponseMessage"
name="output"/>
</bpws:variables>
...
<bpws:assign name="Assign" validate="no">
    <bpws:copy>
        <bpws:from expressionLanguage="...xpath1.0">
            <![CDATA[round(10 + number($input.payload))]]>
        </bpws:from>
        <bpws:to part="payload" variable="output"/>

</bpws:copy>
</bpws:assign>

I saw this cause a problem when I was trying to invoke a third party service
that takes an integer as an input.  The service didn't like the .0.

Any ideas?

Thank you.
-Jon



On 11/17/08 8:00 AM, "Matthieu Riou" <matthieu@offthelip.org> wrote:

> On Fri, Nov 14, 2008 at 10:50 AM, Jonathan Coogan <
> Jonathan.Coogan@attachmate.com> wrote:
> 
>> I am also looking for an answer to this question.  Here's another example
>> that does not work..
>> 
>> <bpws:forEach counterName="Counter" name="ForEach" parallel="no">
>>     <bpws:startCounterValue expressionLanguage="...xpath1.0">
>>        <![CDATA[1]]>
>>    </bpws:startCounterValue>
>>    <bpws:finalCounterValue expressionLanguage="...xpath1.0">
>>        <![CDATA[10]]>
>>    </bpws:finalCounterValue>
>>    <bpws:scope>
>>        <bpws:if name="If">
>>            <!-- We never get here -->
>>            <bpws:empty name="NeverGetsHere"/>
>>            <bpws:condition expressionLanguage="...xpath1.0">
>>                <![CDATA[$Counter > 5]]>
>>            </bpws:condition>
>>        </bpws:if>
>>    </bpws:scope>
>> </bpws:forEach>
>> 
>> Can anyone else reproduce this?
>> 
> 
> I can't see anything wrong with your process. If you already have a process
> that looks like a testcase, could you create a Jira issues attaching it?
> This way I can give it a try and also include it in our test suite.
> 
> Thanks!
> Matthieu
> 
> 
>> 
>> Thanks.
>> -Jon
>> 
>> 
>> On 11/13/08 12:12 PM, "Les Spivey" <Les.Spivey@attachmate.com> wrote:
>> 
>>> Alex, sorry, I was not subscribed to the list so I didn't get your reply
>>> directly.  I am now.  Here is the bpel fragment containing the for each.
>>> It was created with the Eclipse BPEL project's designer.  Please let me
>>> know if you need anything else.
>>> 
>>> 
>>> 
>>> <bpws:forEach counterName="Counter" name="ForEach" parallel="no">
>>> 
>>> <bpws:startCounterValue
>>> expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![C
>>> DATA[1]]></bpws:startCounterValue>
>>> 
>>>       <bpws:finalCounterValue
>>> expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![C
>>> DATA[count($input.payload/tns:Names)]]></bpws:finalCounterValue>
>>> 
>>> <bpws:scope>
>>> 
>>> <bpws:sequence name="ForEachSequence">
>>> 
>>>                                                 <bpws:assign
>>> name="BuildOutput" validate="no">
>>> 
>>> 
>>> <bpws:copy>
>>> 
>>>                                                 <bpws:from
>>> expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"><![C
>>> DATA[concat($output.payload,
>>> $input.payload/tns:Names[$Counter])]]></bpws:from>
>>> 
>>>                                                 <bpws:to part="payload"
>>> variable="output"/>
>>> 
>>> 
>>> </bpws:copy>
>>> 
>>>                                 </bpws:assign>
>>> 
>>>                                 <bpws:if name="IfDelimiterrRequierd">
>>> 
>>>                                                 <bpws:assign
>>> name="AddDelimiter" validate="no">
>>> 
>>>                                                 <bpws:copy>
>>> 
>>> 
>>> <bpws:from
>>> expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"><![C
>>> DATA[concat($output.payload, ', ')]]></bpws:from>
>>> 
>>>                                                                 <bpws:to
>>> part="payload" variable="output"/>
>>> 
>>>                                                 </bpws:copy>
>>> 
>>>                                                 </bpws:assign>
>>> 
>>>                                                 <bpws:condition
>>> expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![C
>>> DATA[$Counter < count($input.payload/tns:Names)]]></bpws:condition>
>>> 
>>>                                 </bpws:if>
>>> 
>>> </bpws:sequence>
>>> 
>>> </bpws:scope>
>>> 
>>> </bpws:forEach>
>>> 
>>> 
>>> 
>>> 
>>> 
>>> From: Les Spivey
>>> Sent: Thursday, November 13, 2008 10:38 AM
>>> To: 'user@ode.apache.org'
>>> Subject: using foreach counter
>>> 
>>> 
>>> 
>>> I am using the BPEL ForEach activity to loop over a list of names which
>>> is the input value of the receive.  The name of my ForEach counter
>>> variable is Counter.  The start counter value is 1 and the end counter
>>> value is count($input.payload/tns:Names).  This works correctly.
>>> However, within the scope of the ForEach I have an If with the condition
>>> $Counter < count($input.payload/tns:Names).  Apparently, the condition
>>> never evaluates to true since the body of the If is never entered.  Is
>>> the syntax of the condition incorrect or is the problem with Counter?
>>> Can the ForEach counter be used in this way?
>>> 
>>> 
>>> 
>>> Thanks.
>>> 
>>> Les
>>> 
>>> 
>>> 
>> 
>> 


Mime
View raw message