Frage

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

War es hilfreich?

Lösung

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

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top