【问题标题】:Bpel arrays transformation foreachBpel 数组转换 foreach
【发布时间】:2013-08-26 12:19:06
【问题描述】:

我有一个接收数组并输出另一个数组的 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 数组

【问题讨论】:

  • 你得到什么异常?此外,如果您使用并行 foreach 并且不使用原子或隔离范围之类的东西,则很可能会覆盖更改。取决于实现。
  • 我在使用 foreach 方法之前收到了 ORAMED-03303。你知道我该如何调试吗?我也会尝试你的隔离范围建议
  • @vanto,据我了解,我的主要问题是:$cmets.VwCommentCollection/ns3:VwComment[$c]/ns3:id 为每个返回 id。如何在输出数组中推送对象?我正在尝试在 $outputVariable.payload/ns2:comment[$c]/ns2:id 中设置该值但是,我不知道是否需要用我的大小或什么来初始化我的 $outputVariable.payload/ns2:comment
  • 现在,我的问题是如何将一个对象放入我的输出数组中。我创建了一个临时变量并将 $cmets.VwCommentCollection/ns3:VwComment[$c]/ns3:id 之类的内容放入其中,因此,我需要将其推送到我的服务的输出变量中
  • 如果您使用 oracle,这可能会有所帮助:stackoverflow.com/questions/5864666/…

标签: soa bpel


【解决方案1】:

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

我在 BPEL 中使用了附加操作

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-02-19
    • 2016-07-19
    • 1970-01-01
    • 1970-01-01
    • 2017-11-21
    • 2017-05-03
    • 2019-10-01
    • 2017-01-31
    相关资源
    最近更新 更多