ode-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill McCusker <wmccus...@parasoft.com>
Subject Re: When we need to initialize a variable
Date Thu, 09 Jul 2009 13:10:18 GMT
Hi,

Variables need to be initialized before they are assigned from or when 
assigned to using a query or an expression or if they are used as to 
input to an invoke or in conditional expressions. If you are just 
assigning directly to a variable's message part with no query then no 
initialization is needed. Thats why the second example needs no 
initialization.

Bill McCusker

phanlesang wrote:
> Hi Everyone!
> I'm getting confused about when we need to initialize a variable in BPEL 2.0
> though BPEL 2.0 standard says that every variable must be initialized before
> using.
> For example:
> In the HelloBPELProcess example, I see the variable output is initialized:
>
> <bpel:assign validate="no" name="createResponse">
>             <bpel:copy>
>                 <bpel:from>
>                     <bpel:literal
> xml:space="preserve"><tns:HelloBPELProcessResponse
> xmlns:tns="http://www.se.uni-hannover.de/soa08/tutorial/HelloBPELProcess"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>   <tns:result></tns:result>
> </tns:HelloBPELProcessResponse>
> </bpel:literal>
>                 </bpel:from>
>                 <bpel:to variable="output" part="payload"></bpel:to>
>             </bpel:copy>
>             <bpel:copy>
>                 <bpel:from part="payload" variable="input">
>                     <bpel:query
> queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[tns:input]]></bpel:query>
>                 </bpel:from>
>                 <bpel:to part="payload" variable="output">
>                     <bpel:query
> queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[tns:result]]></bpel:query>
>                 </bpel:to>
>             </bpel:copy>
>         </bpel:assign>
>
> But in the SimpleInvokeProcess process, the variable output is not
> initialized:
>
> <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" 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> 
>
> Thanks for any help!
>
> -----
> Sang PL  http://www.nabble.com/file/u1501219/20.gif 
>   


Mime
View raw message