WSO2 BPEL 分配给映射列表或集合
WSO2 BPEL assign to mapping list or collection
我正在使用 WSO2 BPS 3.2.0,但在为映射列表赋值时遇到了一个奇怪的问题。
我有用
初始化的消息类型变量 ObjectMappings
<tns:Message xmlns:tns="http://www.test.sk">
<tns:ObjectMappings>
<tns:ObjectMapping>
<tns:ObjectId/>
<tns:Id/>
</tns:ObjectMapping>
</tns:ObjectMappings>
</tns:Message>
我在输入变量中有另一个集合。我遍历输入和处理数据。最后,我将每个处理过的 ObjectId 的新 Id 分配给上面的变量。
<bpel:copy>
<bpel:from part="return" variable="input"><bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">
<![CDATA[Body/Object[round($Counter)]/@Id]]></bpel:query></bpel:from>
<bpel:to part="parameters" variable="ObjectMappings"><bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">
<![CDATA[ns4:ObjectMappings/ns4:ObjectMapping[round($Counter)]/ns4:ObjectId]]></bpel:query></bpel:to>
</bpel:copy>
但不幸的是,它以错误 {http://docs.oasis-open.org/wsbpel/2.0/process/executable}selectionFailure 结束:没有表达式的结果:'ObjectMappings/ObjectMapping[round($Counter)]/ObjectId' 反对
<Message xmlns="http://www.test.sk">
<tns:ObjectMappings xmlns="" xmlns:tns="http://www.test.sk">
<tns:ObjectMapping>
<tns:ObjectId/>
<tns:Id/>
</tns:ObjectMapping>
<tns:ObjectMapping>
<tns:ObjectId/>
<tns:Id/>
</tns:ObjectMapping>
</tns:ObjectMappings>
故障数据 无可用数据。
计数器值 = 1 时出现故障
当我用固定值 1 替换索引值 round($Counter) 时,它工作正常。即使我添加逻辑来处理 2 个具有固定值的循环,它最终也没有错误。
所以问题是:如何将值赋值到集合中?
我找到了分配新元素时更改顺序的解决方案。
最初我在 variable
的末尾添加了新元素
<tns:ObjectMappings xmlns="" xmlns:tns="http://www.test.sk">
<tns:ObjectMapping>
<tns:ObjectId>1</tns:ObjectId>
<tns:Id>10</tns:Id>
</tns:ObjectMapping>
<tns:ObjectMapping>
<tns:ObjectId/>
<tns:Id/>
</tns:ObjectMapping>
</tns:ObjectMappings>
所以我不得不使用索引来赋值。
现在我在 variable
的开头添加新元素
<tns:ObjectMappings xmlns="" xmlns:tns="http://www.test.sk">
<tns:ObjectMapping>
<tns:ObjectId/>
<tns:Id/>
</tns:ObjectMapping>
<tns:ObjectMapping>
<tns:ObjectId>1</tns:ObjectId>
<tns:Id>10</tns:Id>
</tns:ObjectMapping>
</tns:ObjectMappings>
现在我可以通过固定索引=1来赋值
我找到了分配新元素时更改顺序的解决方案。
最初我在变量的末尾添加了新元素。所以我不得不使用索引来赋值。
现在我在变量的开头添加新元素。所以我可以通过 fixed index = 1
来赋值
<bpel:to part="parameters" variable="ObjectMappings"><bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">
<![CDATA[ns4:ObjectMappings/ns4:ObjectMapping[1]/ns4:ObjectId]]></bpel:query>
</bpel:to>
我正在使用 WSO2 BPS 3.2.0,但在为映射列表赋值时遇到了一个奇怪的问题。
我有用
<tns:Message xmlns:tns="http://www.test.sk">
<tns:ObjectMappings>
<tns:ObjectMapping>
<tns:ObjectId/>
<tns:Id/>
</tns:ObjectMapping>
</tns:ObjectMappings>
</tns:Message>
我在输入变量中有另一个集合。我遍历输入和处理数据。最后,我将每个处理过的 ObjectId 的新 Id 分配给上面的变量。
<bpel:copy>
<bpel:from part="return" variable="input"><bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">
<![CDATA[Body/Object[round($Counter)]/@Id]]></bpel:query></bpel:from>
<bpel:to part="parameters" variable="ObjectMappings"><bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">
<![CDATA[ns4:ObjectMappings/ns4:ObjectMapping[round($Counter)]/ns4:ObjectId]]></bpel:query></bpel:to>
</bpel:copy>
但不幸的是,它以错误 {http://docs.oasis-open.org/wsbpel/2.0/process/executable}selectionFailure 结束:没有表达式的结果:'ObjectMappings/ObjectMapping[round($Counter)]/ObjectId' 反对
<Message xmlns="http://www.test.sk">
<tns:ObjectMappings xmlns="" xmlns:tns="http://www.test.sk">
<tns:ObjectMapping>
<tns:ObjectId/>
<tns:Id/>
</tns:ObjectMapping>
<tns:ObjectMapping>
<tns:ObjectId/>
<tns:Id/>
</tns:ObjectMapping>
</tns:ObjectMappings>
故障数据 无可用数据。
计数器值 = 1 时出现故障 当我用固定值 1 替换索引值 round($Counter) 时,它工作正常。即使我添加逻辑来处理 2 个具有固定值的循环,它最终也没有错误。 所以问题是:如何将值赋值到集合中?
我找到了分配新元素时更改顺序的解决方案。
最初我在 variable
<tns:ObjectMappings xmlns="" xmlns:tns="http://www.test.sk">
<tns:ObjectMapping>
<tns:ObjectId>1</tns:ObjectId>
<tns:Id>10</tns:Id>
</tns:ObjectMapping>
<tns:ObjectMapping>
<tns:ObjectId/>
<tns:Id/>
</tns:ObjectMapping>
</tns:ObjectMappings>
所以我不得不使用索引来赋值。 现在我在 variable
的开头添加新元素<tns:ObjectMappings xmlns="" xmlns:tns="http://www.test.sk">
<tns:ObjectMapping>
<tns:ObjectId/>
<tns:Id/>
</tns:ObjectMapping>
<tns:ObjectMapping>
<tns:ObjectId>1</tns:ObjectId>
<tns:Id>10</tns:Id>
</tns:ObjectMapping>
</tns:ObjectMappings>
现在我可以通过固定索引=1来赋值
我找到了分配新元素时更改顺序的解决方案。
最初我在变量的末尾添加了新元素。所以我不得不使用索引来赋值。
现在我在变量的开头添加新元素。所以我可以通过 fixed index = 1
<bpel:to part="parameters" variable="ObjectMappings"><bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">
<![CDATA[ns4:ObjectMappings/ns4:ObjectMapping[1]/ns4:ObjectId]]></bpel:query>
</bpel:to>