Bpel数组转换foreach(Bpel arrays transformation foreach)

编程入门 行业动态 更新时间:2024-10-08 00:33:38
Bpel数组转换foreach(Bpel arrays transformation foreach)

我有一个bpel进程,它接收一个数组并输出另一个数组。

问题是,我需要获得第一个元素,填充第二个元素并在第二个元素中添加一些元素。

我的第一个数组来自这种对象:

<xsd:complexType name="comment_A"> <xsd:sequence> <xsd:element name="id" type="xsd:int"/> <xsd:element name="username" type="xsd:string"/> <xsd:element name="name" type="xsd:string"/> <xsd:element name="picture" type="xsd:base64Binary"/> <xsd:element name="date" type="xsd:string"/> <xsd:element name="hour" type="xsd:string"/> <xsd:element name="bus-line" type="xsd:string"/> <xsd:element name="bus-number" type="xsd:integer"/> <xsd:element name="description" type="xsd:string"/> <xsd:element name="rate" type="xsd:int"/> </xsd:sequence> </xsd:complexType>

我的第二个:

<xsd:complexType name="comment_B"> <xsd:sequence> <xsd:element name="id" type="xsd:int"/> <xsd:element name="username" type="xsd:string"/> <xsd:element name="name" type="xsd:string"/> <xsd:element name="picture" type="xsd:base64Binary"/> <xsd:element name="date" type="xsd:string"/> <xsd:element name="hour" type="xsd:string"/> <xsd:element name="bus-line" type="xsd:string"/> <xsd:element name="bus-number" type="xsd:integer"/> <xsd:element name="description" type="xsd:string"/> <xsd:element name="rate" type="xsd:int"/> <xsd:element name="type-comment" type="xsd:string"/> <xsd:element name="liked-number" type="xsd:int"/> </xsd:sequence> </xsd:complexType>

首先,我尝试迭代第一个数组,用第二个数组填充两个共同的属性。 我尝试使用forEach元素。

我的代码看起来像这样:

<forEach parallel="yes" counterName="c" name="forEachComment"> <startCounterValue>1</startCounterValue> <finalCounterValue>count($comments.VwCommentCollection/ns3:VwComment)</finalCounterValue> <scope name="Scope1"> <assign name="assignResult"> <extensionAssignOperation> <bpelx:copyList> <bpelx:from>$comments.VwCommentCollection[$c]</bpelx:from> <bpelx:to>$outputVariable.payload</bpelx:to> </bpelx:copyList> </extensionAssignOperation> <copy> <from>$comments.VwCommentCollection[$c]/ns3:VwComment/ns3:id</from> <to>$outputVariable.payload/ns2:comment/ns2:id</to> </copy> </assign> </scope> </forEach>

我尝试使用id元素进行测试,但是当comment_A数组的大小大于1时,我收到一个异常

$ comment是我的变量,其中是comment_A数组

I have a bpel process which receive an array and output another one.

The thing is, I need to get the first one elements, populate the second one and add some for elements in the second one.

My first one array is from this kind of object:

<xsd:complexType name="comment_A"> <xsd:sequence> <xsd:element name="id" type="xsd:int"/> <xsd:element name="username" type="xsd:string"/> <xsd:element name="name" type="xsd:string"/> <xsd:element name="picture" type="xsd:base64Binary"/> <xsd:element name="date" type="xsd:string"/> <xsd:element name="hour" type="xsd:string"/> <xsd:element name="bus-line" type="xsd:string"/> <xsd:element name="bus-number" type="xsd:integer"/> <xsd:element name="description" type="xsd:string"/> <xsd:element name="rate" type="xsd:int"/> </xsd:sequence> </xsd:complexType>

My second one:

<xsd:complexType name="comment_B"> <xsd:sequence> <xsd:element name="id" type="xsd:int"/> <xsd:element name="username" type="xsd:string"/> <xsd:element name="name" type="xsd:string"/> <xsd:element name="picture" type="xsd:base64Binary"/> <xsd:element name="date" type="xsd:string"/> <xsd:element name="hour" type="xsd:string"/> <xsd:element name="bus-line" type="xsd:string"/> <xsd:element name="bus-number" type="xsd:integer"/> <xsd:element name="description" type="xsd:string"/> <xsd:element name="rate" type="xsd:int"/> <xsd:element name="type-comment" type="xsd:string"/> <xsd:element name="liked-number" type="xsd:int"/> </xsd:sequence> </xsd:complexType>

So first, I tried iterate over the first array to populate the second one with properties which both have in common. I tried use forEach element.

My code seems like this:

<forEach parallel="yes" counterName="c" name="forEachComment"> <startCounterValue>1</startCounterValue> <finalCounterValue>count($comments.VwCommentCollection/ns3:VwComment)</finalCounterValue> <scope name="Scope1"> <assign name="assignResult"> <extensionAssignOperation> <bpelx:copyList> <bpelx:from>$comments.VwCommentCollection[$c]</bpelx:from> <bpelx:to>$outputVariable.payload</bpelx:to> </bpelx:copyList> </extensionAssignOperation> <copy> <from>$comments.VwCommentCollection[$c]/ns3:VwComment/ns3:id</from> <to>$outputVariable.payload/ns2:comment/ns2:id</to> </copy> </assign> </scope> </forEach>

I tried do this first just with id element for a test, however when the comment_A array has size greater than 1, I receive an exception

$comment is my variable which comment_A array

最满意答案

我在巴西的这个博客后找到了一个解决方案: http : //blog.iprocess.com.br/2012/09/oracle-soa-suite-11g-uso-da-atividade-assign-no-bpel/

我在BPEL中使用了append opperation

I found a solution following this Brazilian blog: http://blog.iprocess.com.br/2012/09/oracle-soa-suite-11g-uso-da-atividade-assign-no-bpel/

I used append opperation inside BPEL

更多推荐

本文发布于:2023-07-30 14:20:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1338792.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数组   Bpel   foreach   transformation   arrays

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!