1 Reply Latest reply on Jan 3, 2013 5:32 PM by oracledigger

    BPEL, Assign loop from multiple nodes, how to do ?

    oracledigger
      Hello

      In a BPEL process, there is a call to a partnerlink that sends the following result :

      <Invoke_PartnerLink1_OutputVariable>
      <part name="payload" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <MyResponse xmlns:ns0="http://my.model.com"
      xmlns="http://my.model.com">
      <ns0:GRC>0000</ns0:GRC>
      <ns0:OOP>
      <ns0:SI>AAAA</ns0:SI>
      <ns0:RC>1111</ns0:RC>
      </ns0:OOP>
      <ns0:OOP>
      <ns0:SI>BBBB</ns0:SI>
      <ns0:RC>2222</ns0:RC>
      </ns0:OOP>
      <ns0:OOP>
      <ns0:SI>CCCC</ns0:SI>
      <ns0:RC>3333</ns0:RC>
      </ns0:OOP>
      <ns0:OOP>
      <ns0:SI>DDDD</ns0:SI>
      <ns0:RC>4444</ns0:RC>
      </ns0:OOP>
           </MyResponse>
      </part>
      </Invoke_PartnerLink1_OutputVariable>


      Then I must loop through all the <ns0:OOP> nodes to get each values (AAAA,1111) (BBBB,2222) ... and affect these values to another input variable that will be sent to another partnerlink...

      Question is : How to loop through each node ?

      I use an index that is in a BPEL variable (from 1 to 4) but I don't know how to put this index in the Assign, Eg :

      <from expression="bpws:getVariableData('Invoke_PartnerLink1_OutputVariable','payload','/ns0:MyResponse/ns0:OOP[bpws:getVariableData('MyIndexVariable')]/ns0:SI')"/>

      But there is an error saying that the XPATH query is not ok. I tried by replacing the single quotes with double quotes everywhere in the from expression apart around the 'MyIndexVariable' but I'm still stuck and don't see any way to do that...

      Thanks if any clues!

      Edited by: oracledigger on Jan 3, 2013 4:26 PM
        • 1. Re: BPEL, Assign loop from multiple nodes, how to do ?
          oracledigger
          Wow I did not thought that it was so hard to do this !! (<=> iterate through incoming xml nodes, assign values from one xml node to another variable, and calling another partnerlink...).

          What I did :

          - Create a XSD file with an "element" called "parameters" that is a complexType that contains another element named "item" that is also a complexType that contains a sequence with my own variable names (2).

          - Assign my needed values to a variable based on the preceding XSD file (amongst these : My Incremental Index !!).

          - Create a transform activity with my needed input values :
          ---> The xml variable with the nodes I need to go through
          ---> The index

          - In the transform activity I acces my variables with such this code :
          <xsl:value-of select="/ns0:OOR/ns0:OOP[number($XsltParams/p:parameters/p:item/p:OOPIndex)]/ns0:SI"/>

          This was hard to understand, but as everything, once one has done it once, then everything rulez !

          The links that "saved" me are :

          http://sridhar-oraclefusion.blogspot.fr/
          https://blogs.oracle.com/sdhurjati/entry/passing_parameters_to_xslt_fil
          http://tech-learnings.blogspot.fr/2010/04/using-xsl-parameters-in-soa-11g.html

          Have fun with SCA lol !!!!!

          Edited by: oracledigger on Jan 3, 2013 6:31 PM