You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ode.apache.org by phanlesang <ph...@gmail.com> on 2009/07/14 02:13:26 UTC
Example of using loop activities
Hi everyone,
I looking for an example of using loop activities: while, for each and
repeat until.
Would you please give some links.
Thanks in advance!
-----
Sang PL
--
View this message in context: http://www.nabble.com/Example-of-using-loop-activities-tp24471660p24471660.html
Sent from the Apache Ode User mailing list archive at Nabble.com.
Re: Example of using loop activities
Posted by phanlesang <ph...@gmail.com>.
Hi Denis
Thanks for your help.
I got it work after changing a little bit of initialization for $detailIndex
Before:
<bpel:assign validate="no">
<bpel:copy>
<bpel:from>
1
</bpel:from>
<bpel:to variable="detailIndex"></bpel:to>
</bpel:copy>
</bpel:assign>
After:
<bpel:assign validate="no">
<bpel:copy>
<bpel:from>
<bpel:literal xml:space="preserve">
1
</bpel:literal>
</bpel:from>
<bpel:to variable="detailIndex"></bpel:to>
</bpel:copy>
</bpel:assign>
I also don't know why it works. I took the first code from an example on
activebpel.org
http://www.activebpel.org/samples/samples-4/BPEL_Samples/BPEL_Samples.tar.gz
And I wonder if it could work on Apache ODE engine? Is it only need to write
a proper deploy.xml or some other changes?
Denis Weerasiri wrote:
>
> Hi phanlesang,
> One thing you can try is ODE Instant Management service to check whether
> the
> variable "detailIndex" is modified in a loop.
> During the startup of ODE it deploys a Management service which can be
> used
> to monitor the instance variables like "detailIndex".
>
> You can use REST as follows
> To get the instance information use (iid=instance id) -
> http://localhost:8080/ode/processes/InstanceManagement/getInstanceInfo?iid=XXXX
> To get variable information use (sid=scope id , varName=variableName) -
> http://localhost:8080/ode/processes/InstanceManagement/getVariableInfo?sid=YYYY&varName=detailIndex
>
> Hope this will help
> Cheers,
> Denis Weerasiri
> http://ddweerasiri.blogspot.com
>
> On Tue, Jul 14, 2009 at 6:09 AM, phanlesang <ph...@gmail.com> wrote:
>
>>
>> Hi,
>> I've just tested an example using while loop. But it got run out of
>> memory
>> error. is there anything wrong with my code?
>>
>> Here is my code:
>>
>> <!-- SimpleInvokeProcess BPEL Process [Generated by the Eclipse BPEL
>> Designer] -->
>> <bpel:process name="SimpleInvokeProcess"
>>
>> targetNamespace="
>> http://www.se.uni-hannover.de/soa08/tutorial/SimpleInvokeProcess"
>> suppressJoinFailure="yes"
>>
>> xmlns:tns="
>> http://www.se.uni-hannover.de/soa08/tutorial/SimpleInvokeProcess"
>>
>> xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>>
>> xmlns:ns1="http://randomHelloService.tutorial.soa08.se.unihannover.de">
>>
>> <!-- Import the client WSDL -->
>> <bpel:import
>> namespace="http://randomHelloService.tutorial.soa08.se.unihannover.de"
>> location="RandomHelloService.wsdl"
>> importType="http://schemas.xmlsoap.org/wsdl/"></bpel:import>
>> <bpel:import location="SimpleInvokeProcessArtifacts.wsdl"
>> namespace="
>> http://www.se.uni-hannover.de/soa08/tutorial/SimpleInvokeProcess"
>> importType="http://schemas.xmlsoap.org/wsdl/" />
>>
>> <!-- =================================================================
>> -->
>> <!-- PARTNERLINKS
>> -->
>> <!-- List of services participating in this BPEL process
>> -->
>> <!-- =================================================================
>> -->
>> <bpel:partnerLinks>
>> <!-- The 'client' role represents the requester of this service.
>> -->
>> <bpel:partnerLink name="client"
>> partnerLinkType="tns:SimpleInvokeProcess"
>> myRole="SimpleInvokeProcessProvider"
>> />
>> <bpel:partnerLink name="RandomHelloPL"
>> partnerLinkType="tns:RandomHelloPLT"
>> partnerRole="RandomHelloServiceProvider"></bpel:partnerLink>
>> </bpel:partnerLinks>
>>
>> <!-- =================================================================
>> -->
>> <!-- VARIABLES
>> -->
>> <!-- List of messages and XML documents used within this BPEL process
>> -->
>> <!-- =================================================================
>> -->
>> <bpel:variables>
>> <!-- Reference to the message passed as input during initiation
>> -->
>> <bpel:variable name="detailIndex" type="xsd:integer"/>
>>
>> <bpel:variable name="input"
>> messageType="tns:SimpleInvokeProcessRequestMessage"/>
>>
>> <!--
>> Reference to the message that will be returned to the requester
>> -->
>> <bpel:variable name="output"
>> messageType="tns:SimpleInvokeProcessResponseMessage"/>
>> <bpel:variable name="RandomHelloRequest"
>> messageType="ns1:sayHelloRequest"></bpel:variable>
>> <bpel:variable name="RandomHelloResponse"
>> messageType="ns1:sayHelloResponse"></bpel:variable>
>> </bpel:variables>
>>
>> <!-- =================================================================
>> -->
>> <!-- ORCHESTRATION LOGIC
>> -->
>> <!-- Set of activities coordinating the flow of messages across the
>> -->
>> <!-- services integrated within this business process
>> -->
>> <!-- =================================================================
>> -->
>> <bpel:sequence name="main">
>>
>> <!-- Receive input from requester.
>> Note: This maps to operation defined in
>> SimpleInvokeProcess.wsdl
>> -->
>> <bpel:receive name="receiveInput" partnerLink="client"
>> portType="tns:SimpleInvokeProcess"
>> operation="process" variable="input"
>> createInstance="yes"/>
>>
>> <bpel:assign validate="no">
>> <bpel:copy>
>> <bpel:from>
>> 1
>> </bpel:from>
>> <bpel:to variable="detailIndex"></bpel:to>
>> </bpel:copy>
>> </bpel:assign>
>>
>> <bpel:while>
>> <bpel:condition
>> expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">
>> <![CDATA[$detailIndex <= 10]]>
>> </bpel:condition>
>> <!-- Generate reply to synchronous request -->
>> <bpel:assign validate="no" name="PrepareRandomHelloRequest">
>> <bpel:copy>
>> <bpel:from>
>> <bpel:literal xml:space="preserve"><impl:sayHello
>> xmlns:impl="http://randomHelloService.tutorial.soa08.se.unihannover.de"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>> <impl:withSpace></impl:withSpace>
>> </impl:sayHello>
>> </bpel:literal>
>> </bpel:from>
>> <bpel:to variable="RandomHelloRequest"
>> part="parameters"></bpel:to>
>> </bpel:copy>
>> <bpel:copy>
>> <bpel:from>
>> <bpel:literal xml:space="preserve">true</bpel:literal>
>> </bpel:from>
>> <bpel:to part="parameters" variable="RandomHelloRequest">
>> <bpel:query
>>
>> queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[ns1:withSpace]]></bpel:query>
>> </bpel:to>
>> </bpel:copy>
>> </bpel:assign>
>> <bpel:invoke name="GetGreeting" partnerLink="RandomHelloPL"
>> operation="sayHello" portType="ns1:RandomHelloService"
>> inputVariable="RandomHelloRequest"
>> outputVariable="RandomHelloResponse"></bpel:invoke>
>>
>> <bpel:assign validate="no">
>> <bpel:copy>
>> <bpel:from>
>> <![CDATA[$detailIndex + 1]]>
>> </bpel:from>
>> <bpel:to variable="detailIndex"></bpel:to>
>> </bpel:copy>
>> </bpel:assign>
>>
>> </bpel:while>
>> <bpel:assign validate="no" name="PrepareOutput">
>> <bpel:copy>
>> <bpel:from xmlns:http="urn:http:namesapce">
>>
>> <![CDATA[concat(bpel:getVariableData('RandomHelloResponse', 'parameters',
>> '/'), bpel:getVariableData('input', 'payload', '/'))]]>
>> </bpel:from>
>> <bpel:to variable="output" part="payload"></bpel:to>
>> </bpel:copy>
>> </bpel:assign>
>> <bpel:reply name="replyOutput"
>> partnerLink="client"
>> portType="tns:SimpleInvokeProcess"
>> operation="process"
>> variable="output"
>> />
>> </bpel:sequence>
>> </bpel:process>
>>
>> Thanks for any help!
>>
>>
>> -----
>> Sang PL
>> --
>> View this message in context:
>> http://www.nabble.com/Example-of-using-loop-activities-tp24471660p24471879.html
>> Sent from the Apache Ode User mailing list archive at Nabble.com.
>>
>>
>
>
-----
Sang PL
--
View this message in context: http://www.nabble.com/Example-of-using-loop-activities-tp24471660p24478233.html
Sent from the Apache Ode User mailing list archive at Nabble.com.
Re: Example of using loop activities
Posted by Denis Weerasiri <dd...@gmail.com>.
Hi phanlesang,
One thing you can try is ODE Instant Management service to check whether the
variable "detailIndex" is modified in a loop.
During the startup of ODE it deploys a Management service which can be used
to monitor the instance variables like "detailIndex".
You can use REST as follows
To get the instance information use (iid=instance id) -
http://localhost:8080/ode/processes/InstanceManagement/getInstanceInfo?iid=XXXX
To get variable information use (sid=scope id , varName=variableName) -
http://localhost:8080/ode/processes/InstanceManagement/getVariableInfo?sid=YYYY&varName=detailIndex
Hope this will help
Cheers,
Denis Weerasiri
http://ddweerasiri.blogspot.com
On Tue, Jul 14, 2009 at 6:09 AM, phanlesang <ph...@gmail.com> wrote:
>
> Hi,
> I've just tested an example using while loop. But it got run out of memory
> error. is there anything wrong with my code?
>
> Here is my code:
>
> <!-- SimpleInvokeProcess BPEL Process [Generated by the Eclipse BPEL
> Designer] -->
> <bpel:process name="SimpleInvokeProcess"
>
> targetNamespace="
> http://www.se.uni-hannover.de/soa08/tutorial/SimpleInvokeProcess"
> suppressJoinFailure="yes"
>
> xmlns:tns="
> http://www.se.uni-hannover.de/soa08/tutorial/SimpleInvokeProcess"
>
> xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>
> xmlns:ns1="http://randomHelloService.tutorial.soa08.se.unihannover.de">
>
> <!-- Import the client WSDL -->
> <bpel:import
> namespace="http://randomHelloService.tutorial.soa08.se.unihannover.de"
> location="RandomHelloService.wsdl"
> importType="http://schemas.xmlsoap.org/wsdl/"></bpel:import>
> <bpel:import location="SimpleInvokeProcessArtifacts.wsdl"
> namespace="
> http://www.se.uni-hannover.de/soa08/tutorial/SimpleInvokeProcess"
> importType="http://schemas.xmlsoap.org/wsdl/" />
>
> <!-- =================================================================
> -->
> <!-- PARTNERLINKS
> -->
> <!-- List of services participating in this BPEL process
> -->
> <!-- =================================================================
> -->
> <bpel:partnerLinks>
> <!-- The 'client' role represents the requester of this service. -->
> <bpel:partnerLink name="client"
> partnerLinkType="tns:SimpleInvokeProcess"
> myRole="SimpleInvokeProcessProvider"
> />
> <bpel:partnerLink name="RandomHelloPL"
> partnerLinkType="tns:RandomHelloPLT"
> partnerRole="RandomHelloServiceProvider"></bpel:partnerLink>
> </bpel:partnerLinks>
>
> <!-- =================================================================
> -->
> <!-- VARIABLES
> -->
> <!-- List of messages and XML documents used within this BPEL process
> -->
> <!-- =================================================================
> -->
> <bpel:variables>
> <!-- Reference to the message passed as input during initiation -->
> <bpel:variable name="detailIndex" type="xsd:integer"/>
>
> <bpel:variable name="input"
> messageType="tns:SimpleInvokeProcessRequestMessage"/>
>
> <!--
> Reference to the message that will be returned to the requester
> -->
> <bpel:variable name="output"
> messageType="tns:SimpleInvokeProcessResponseMessage"/>
> <bpel:variable name="RandomHelloRequest"
> messageType="ns1:sayHelloRequest"></bpel:variable>
> <bpel:variable name="RandomHelloResponse"
> messageType="ns1:sayHelloResponse"></bpel:variable>
> </bpel:variables>
>
> <!-- =================================================================
> -->
> <!-- ORCHESTRATION LOGIC
> -->
> <!-- Set of activities coordinating the flow of messages across the
> -->
> <!-- services integrated within this business process
> -->
> <!-- =================================================================
> -->
> <bpel:sequence name="main">
>
> <!-- Receive input from requester.
> Note: This maps to operation defined in
> SimpleInvokeProcess.wsdl
> -->
> <bpel:receive name="receiveInput" partnerLink="client"
> portType="tns:SimpleInvokeProcess"
> operation="process" variable="input"
> createInstance="yes"/>
>
> <bpel:assign validate="no">
> <bpel:copy>
> <bpel:from>
> 1
> </bpel:from>
> <bpel:to variable="detailIndex"></bpel:to>
> </bpel:copy>
> </bpel:assign>
>
> <bpel:while>
> <bpel:condition
> expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">
> <![CDATA[$detailIndex <= 10]]>
> </bpel:condition>
> <!-- Generate reply to synchronous request -->
> <bpel:assign validate="no" name="PrepareRandomHelloRequest">
> <bpel:copy>
> <bpel:from>
> <bpel:literal xml:space="preserve"><impl:sayHello
> xmlns:impl="http://randomHelloService.tutorial.soa08.se.unihannover.de"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <impl:withSpace></impl:withSpace>
> </impl:sayHello>
> </bpel:literal>
> </bpel:from>
> <bpel:to variable="RandomHelloRequest"
> part="parameters"></bpel:to>
> </bpel:copy>
> <bpel:copy>
> <bpel:from>
> <bpel:literal xml:space="preserve">true</bpel:literal>
> </bpel:from>
> <bpel:to part="parameters" variable="RandomHelloRequest">
> <bpel:query
>
> queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[ns1:withSpace]]></bpel:query>
> </bpel:to>
> </bpel:copy>
> </bpel:assign>
> <bpel:invoke name="GetGreeting" partnerLink="RandomHelloPL"
> operation="sayHello" portType="ns1:RandomHelloService"
> inputVariable="RandomHelloRequest"
> outputVariable="RandomHelloResponse"></bpel:invoke>
>
> <bpel:assign validate="no">
> <bpel:copy>
> <bpel:from>
> <![CDATA[$detailIndex + 1]]>
> </bpel:from>
> <bpel:to variable="detailIndex"></bpel:to>
> </bpel:copy>
> </bpel:assign>
>
> </bpel:while>
> <bpel:assign validate="no" name="PrepareOutput">
> <bpel:copy>
> <bpel:from xmlns:http="urn:http:namesapce">
>
> <![CDATA[concat(bpel:getVariableData('RandomHelloResponse', 'parameters',
> '/'), bpel:getVariableData('input', 'payload', '/'))]]>
> </bpel:from>
> <bpel:to variable="output" part="payload"></bpel:to>
> </bpel:copy>
> </bpel:assign>
> <bpel:reply name="replyOutput"
> partnerLink="client"
> portType="tns:SimpleInvokeProcess"
> operation="process"
> variable="output"
> />
> </bpel:sequence>
> </bpel:process>
>
> Thanks for any help!
>
>
> -----
> Sang PL
> --
> View this message in context:
> http://www.nabble.com/Example-of-using-loop-activities-tp24471660p24471879.html
> Sent from the Apache Ode User mailing list archive at Nabble.com.
>
>
Re: Example of using loop activities
Posted by phanlesang <ph...@gmail.com>.
Hi,
I've just tested an example using while loop. But it got run out of memory
error. is there anything wrong with my code?
Here is my code:
<!-- SimpleInvokeProcess BPEL Process [Generated by the Eclipse BPEL
Designer] -->
<bpel:process name="SimpleInvokeProcess"
targetNamespace="http://www.se.uni-hannover.de/soa08/tutorial/SimpleInvokeProcess"
suppressJoinFailure="yes"
xmlns:tns="http://www.se.uni-hannover.de/soa08/tutorial/SimpleInvokeProcess"
xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ns1="http://randomHelloService.tutorial.soa08.se.unihannover.de">
<!-- Import the client WSDL -->
<bpel:import
namespace="http://randomHelloService.tutorial.soa08.se.unihannover.de"
location="RandomHelloService.wsdl"
importType="http://schemas.xmlsoap.org/wsdl/"></bpel:import>
<bpel:import location="SimpleInvokeProcessArtifacts.wsdl"
namespace="http://www.se.uni-hannover.de/soa08/tutorial/SimpleInvokeProcess"
importType="http://schemas.xmlsoap.org/wsdl/" />
<!-- =================================================================
-->
<!-- PARTNERLINKS
-->
<!-- List of services participating in this BPEL process
-->
<!-- =================================================================
-->
<bpel:partnerLinks>
<!-- The 'client' role represents the requester of this service. -->
<bpel:partnerLink name="client"
partnerLinkType="tns:SimpleInvokeProcess"
myRole="SimpleInvokeProcessProvider"
/>
<bpel:partnerLink name="RandomHelloPL"
partnerLinkType="tns:RandomHelloPLT"
partnerRole="RandomHelloServiceProvider"></bpel:partnerLink>
</bpel:partnerLinks>
<!-- =================================================================
-->
<!-- VARIABLES
-->
<!-- List of messages and XML documents used within this BPEL process
-->
<!-- =================================================================
-->
<bpel:variables>
<!-- Reference to the message passed as input during initiation -->
<bpel:variable name="detailIndex" type="xsd:integer"/>
<bpel:variable name="input"
messageType="tns:SimpleInvokeProcessRequestMessage"/>
<!--
Reference to the message that will be returned to the requester
-->
<bpel:variable name="output"
messageType="tns:SimpleInvokeProcessResponseMessage"/>
<bpel:variable name="RandomHelloRequest"
messageType="ns1:sayHelloRequest"></bpel:variable>
<bpel:variable name="RandomHelloResponse"
messageType="ns1:sayHelloResponse"></bpel:variable>
</bpel:variables>
<!-- =================================================================
-->
<!-- ORCHESTRATION LOGIC
-->
<!-- Set of activities coordinating the flow of messages across the
-->
<!-- services integrated within this business process
-->
<!-- =================================================================
-->
<bpel:sequence name="main">
<!-- Receive input from requester.
Note: This maps to operation defined in
SimpleInvokeProcess.wsdl
-->
<bpel:receive name="receiveInput" partnerLink="client"
portType="tns:SimpleInvokeProcess"
operation="process" variable="input"
createInstance="yes"/>
<bpel:assign validate="no">
<bpel:copy>
<bpel:from>
1
</bpel:from>
<bpel:to variable="detailIndex"></bpel:to>
</bpel:copy>
</bpel:assign>
<bpel:while>
<bpel:condition
expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">
<![CDATA[$detailIndex <= 10]]>
</bpel:condition>
<!-- Generate reply to synchronous request -->
<bpel:assign validate="no" name="PrepareRandomHelloRequest">
<bpel:copy>
<bpel:from>
<bpel:literal xml:space="preserve"><impl:sayHello
xmlns:impl="http://randomHelloService.tutorial.soa08.se.unihannover.de"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<impl:withSpace></impl:withSpace>
</impl:sayHello>
</bpel:literal>
</bpel:from>
<bpel:to variable="RandomHelloRequest"
part="parameters"></bpel:to>
</bpel:copy>
<bpel:copy>
<bpel:from>
<bpel:literal xml:space="preserve">true</bpel:literal>
</bpel:from>
<bpel:to part="parameters" variable="RandomHelloRequest">
<bpel:query
queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[ns1:withSpace]]></bpel:query>
</bpel:to>
</bpel:copy>
</bpel:assign>
<bpel:invoke name="GetGreeting" partnerLink="RandomHelloPL"
operation="sayHello" portType="ns1:RandomHelloService"
inputVariable="RandomHelloRequest"
outputVariable="RandomHelloResponse"></bpel:invoke>
<bpel:assign validate="no">
<bpel:copy>
<bpel:from>
<![CDATA[$detailIndex + 1]]>
</bpel:from>
<bpel:to variable="detailIndex"></bpel:to>
</bpel:copy>
</bpel:assign>
</bpel:while>
<bpel:assign validate="no" name="PrepareOutput">
<bpel:copy>
<bpel:from xmlns:http="urn:http:namesapce">
<![CDATA[concat(bpel:getVariableData('RandomHelloResponse', 'parameters',
'/'), bpel:getVariableData('input', 'payload', '/'))]]>
</bpel:from>
<bpel:to variable="output" part="payload"></bpel:to>
</bpel:copy>
</bpel:assign>
<bpel:reply name="replyOutput"
partnerLink="client"
portType="tns:SimpleInvokeProcess"
operation="process"
variable="output"
/>
</bpel:sequence>
</bpel:process>
Thanks for any help!
-----
Sang PL
--
View this message in context: http://www.nabble.com/Example-of-using-loop-activities-tp24471660p24471879.html
Sent from the Apache Ode User mailing list archive at Nabble.com.