soa - Bpel arrays transformation foreach -
i have bpel process receive array , output one.
the thing is, need first 1 elements, populate second 1 , add elements in second one.
my first 1 array 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, tried iterate on first array populate second 1 properties both have in common. tried use foreach element.
my code seems 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 first id element test, when comment_a array has size greater 1, receive exception
$comment variable comment_a array
i found solution following 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
Comments
Post a Comment