ifアクティビティ作成時の処理内容
次のコードは、設計完了後の.bpel
ファイルの例を示しています。ifアクティビティでは、if、elseifおよびelseの各ブランチが定義されています。trueと評価された最初のブランチが実行されます。
<sequence> <!-- receive input from requester --> <receive name="receiveInput" partnerLink="client" portType="tns:Test" operation="process" variable="input" createInstance="yes"/> <!-- assign default value --> <assign> <copy> <from>'Value is greater than zero'</from> <to>$output.payload</to> </copy> <assign> <copy> <from>'Value is greater than zero'</from> <to>$output.payload</to> </copy> </assign> <!-- switch depends on the input value field --> <if> <condition>$input.payload > 0</condition> <extensionActivity> <bpelx:exec name="Java_Embedding" version="1.5" language="java"> System.out.println("if condition is true.\n"); </bpelx:exec> </extensionActivity> <elseif> <condition>bpws:getVariableData('input', 'payload') < 0</condition> <assign> <copy> <from>'Value is less than zero'</from> <to>$output.payload</to> </copy> </assign> </elseif> <else> <assign> <copy> <from>'Value is equal to zero'</from> <to>$output.payload</to> </copy> </assign> </else> </if> <!-- respond output to requester --> <reply name="replyOutput" partnerLink="client" portType="tns:Test" operation="process" variable="output"/> </sequence>