6 Replies Latest reply: Jan 24, 2013 2:49 AM by Shankar RSS

    Insert multiples lines into DataObject using a single BAMAdapter call

    773000
      Hello, how are you doing?

      Is it possible to insert multiple lines into a data object using a single BAM Adapter call?

      IHAC a BPEL process that calls a BAM Adapter passing the following XML input:

      <_GrupoDepositoCollection xmlns="http://xmlns.oracle.com/bam">
      <_GrupoDeposito>
      <_CodigoCD>7</_CodigoCD>
      <_Deposito>777</_Deposito>
      </_GrupoDeposito>
      <_GrupoDeposito>
      <_CodigoCD>8</_CodigoCD>
      <_Deposito>888</_Deposito>
      </_GrupoDeposito>
      <_GrupoDeposito>
      <_CodigoCD>9</_CodigoCD>
      <_Deposito>999</_Deposito>
      </_GrupoDeposito>
      </_GrupoDepositoCollection>

      When the BPEL process runs, only the first record is inserted into the DataObject, ie: CodigoCD=7 and Deposito=777. The BAMAdapter is Batch enabled.

      Any hints appreciated.

      Rgds,
      Luiz Malere.
        • 1. Re: Insert multiples lines into DataObject using a single BAMAdapter call
          802750
          I don't think BAM adapter is capable of parsing the xml payload to insert multiple rows using one input. Each adapter invocation is treated as one operation and the fields are mapped using xsl from input to BAM dataobject fields. Batching is used to cache multiple calls to BAM and send them either on batch timeout or on exceeding the upper limit.
          • 2. Re: Insert multiples lines into DataObject using a single BAMAdapter call
            - AR
            Hi Luiz,

            I have done a similar thing. My Sales Order has multiple lines and I need to create one row for each order line present. When you create the BAM sensor action, you will have to use a for-each in the xsl which does the mapping between the payload and BAM data object. For instance, if your BAM data object has fields LineNumber and SubmittedDate and this occurs for each order line, the mapping would like:

            <xsl:stylesheet version="1.0" xmlns:ns0="http://xmlns.oracle.com/bam"
            xmlns:sensor="http://www.order.com/order"
            xmlns:tns="http://xmlns.oracle.com/bpel/sensor"
            xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
            exclude-result-prefixes="xsl tns sensor ns0">
            <xsl:template match="/">
            <ns0:_LineObjectCollection>
            <xsl:for-each select="/tns:actionData/tns:payload/tns:variableData/tns:data/sensor:SalesOrder/sensor:SalesOrderLines/sensor:SalesOrderLine">
            <ns0:_LineObject>
            <xsl:choose>
            <xsl:when test="sensor:AssignedNumber">
            <ns0:_LineNumber>
            <xsl:value-of select="sensor:AssignedNumber"/>
            </ns0:_LineNumber>
            </xsl:when>
            </xsl:choose>
            <xsl:choose>
            <xsl:when test="sensor:OrderDate">
            <ns0:_SubmittedDate>
            <xsl:value-of select="sensor:OrderDate"/>
            </ns0:_SubmittedDate>
            </xsl:when>
            </xsl:choose>
            </ns0:_LineObject>
            </xsl:for-each>
            </ns0:_LineObjectCollection>
            </xsl:template>
            </xsl:stylesheet>


            Cheers,
            -AR
            • 3. Re: Insert multiples lines into DataObject using a single BAMAdapter call
              802750
              Good to know about the workaround where the logic is given in the xsl.
              • 4. Re: Insert multiples lines into DataObject using a single BAMAdapter call
                sab1312
                Hi AR
                I have the same problem but even after using for-each in the xsl, it is not working. Kindly let us know if we need to do any other step also.
                Regards
                Ayush
                • 5. Re: Insert multiples lines into DataObject using a single BAMAdapter call
                  user11986716
                  Hi ,

                  Is there a way we can do this. Even I am facing the issue while inserting multiple rows to BAM through BAM adaptor. The Invoke shows multiple rows being passed but in DO only the first one is stored.

                  Thanks,
                  Sandeep
                  • 6. Re: Insert multiples lines into DataObject using a single BAMAdapter call
                    Shankar
                    Hi LMalere,


                    Is it possible to insert multiple lines into a data object using a single BAM Adapter call.. its very easy to to insert. All you need to do is in XSLT use for-earh loop.

                    this is the example for for each loop.

                    http://www.w3schools.com/xsl/xsl_for_each.asp

                    soa related example

                    http://javaoraclesoa.blogspot.in/2012/03/loops-in-bpel-11-and-20.html


                    I hope this will be helpful:)

                    Best Regards
                    Siva Sankar