Integration

Get Involved. Join the Conversation.

Topic

    Nagesh Manda
    xpathExpr in Business Events for supplier return...
    Topic posted August 21, 2019 by Nagesh MandaSilver Medal: 2,000+ Points, tagged Adapters, ERP Cloud, Events, Integration, PaaS, xml 
    104 Views, 23 Comments
    Title:
    xpathExpr in Business Events for supplier return transactions
    Content:

    Hi All,

    I have been struggling to filter the business events data to receive the right data in OIC for a supplier return transactions in Fusion.

    I have gone through all the blogs and tried different approaches but still having issues while filtering the events.

    The expression which i have tried are as given below.

     

    <xpathExpr 
    xmlns:ns_0="http://xmlns.oracle.com/adf/svc/types/" 
    xmlns:ns_1="http://xmlns.oracle.com/apps/scm/receiving/receipts/receivingTransaction/" 
    xmlns:ns_2="http://xmlns.oracle.com/apps/scm/receiving/receipts/receivingTransaction/types/">
    $eventPayload/ns_2:result/ns_0:Value/ns_1:TransactionType="RETURN TO VENDOR"
    </xpathExpr>

    <xpathExpr 
    xmlns:ns0="http://xmlns.oracle.com/apps/scm/receiving/receipts/receivingTransaction/" 
    xmlns:ns1="http://xmlns.oracle.com/apps/scm/receiving/receipts/receivingTransaction/types/">
    $eventPayload/ns1:result/ns0:Value/ns0:TransactionType="RETURN TO VENDOR"
    </xpathExpr>

    When i used the above the expression i was unable to receive the events in OIC but when i use the below expression i was able to view the message in OIC but the right data was not filtered out.

    <xpathExpr xmlns:ns_0="http://xmlns.oracle.com/adf/svc/types/" xmlns:ns_1="http://xmlns.oracle.com/apps/scm/receiving/receipts/receivingTransaction/" xmlns:ns_2="http://xmlns.oracle.com/apps/scm/receiving/receipts/receivingTransaction/types/">$eventPayload/ns_2:result/ns_0:TransactionType="RETURN TO VENDOR"</xpathExpr>

    Appreciate any help in this regard.

    Thanks,

    Nagesh.

     

    Document:

    Comment

     

    • Kanchankumar Khedkar

      Please try to use below expression - 

      <xpathExpr xmlns:ns_0="http://xmlns.oracle.com/adf/svc/types/" xmlns:ns_1="http://xmlns.oracle.com/apps/scm/receiving/receipts/receivingTransaction/" xmlns:ns_2="http://xmlns.oracle.com/apps/scm/receiving/receipts/receivingTransaction/types/">$eventPayload/ns_2:result/ns_1:TransactionType="RETURN TO VENDOR"</xpathExpr>

       

      • Nagesh Manda

        Hi Kedar,

        The expression didnt work, is there anything else you would want me to try.

        Thanks,

        Nagesh.

        • Kanchankumar Khedkar

          Hello Nagesh, 

          Please try 

          <xpathExpr xmlns:ns_0="http://xmlns.oracle.com/adf/svc/types/" xmlns:ns_1="http://xmlns.oracle.com/apps/scm/receiving/receipts/receivingTransaction/" xmlns:ns_2="http://xmlns.oracle.com/apps/scm/receiving/receipts/receivingTransaction/types/">$eventPayload//ns_2:result//ns_1:TransactionType="RETURN TO VENDOR"</xpathExpr>

          If this does not work, please execute findTransaction operation and please give the response of findTransactionResponse here. 

          Thank you.

          Kanchan

        • Kanchankumar Khedkar

          Hello Nagesh, 

          Please try 

          <xpathExpr xmlns:ns_0="http://xmlns.oracle.com/adf/svc/types/" xmlns:ns_1="http://xmlns.oracle.com/apps/scm/receiving/receipts/receivingTransaction/" xmlns:ns_2="http://xmlns.oracle.com/apps/scm/receiving/receipts/receivingTransaction/types/">$eventPayload//ns_2:result//ns_1:TransactionType="RETURN TO VENDOR"</xpathExpr>

          If this does not work, please execute findTransaction operation and please give the response of findTransactionResponse here. 

          Thank you.

          Kanchan

          • Nagesh Manda

            Hi Kanchan,

            The above expression didnt work.

            Kindly find the findTransactionResponse payload given below.

            <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:typ="http://xmlns.oracle.com/apps/scm/receiving/receipts/receivingTransaction/types/">
               <env:Header>
                  <wsa:Action>http://xmlns.oracle.com/apps/scm/receiving/receipts/receivingTransaction//ReceivingTransactionService/findTransactionResponse</wsa:Action>
                  <wsa:MessageID>urn:uuid:c01a1598-9199-4269-8669-88e80acaba29</wsa:MessageID>
               </env:Header>
               <env:Body>
                  <ns0:findTransactionResponse xmlns:ns0="http://xmlns.oracle.com/apps/scm/receiving/receipts/receivingTransaction/types/">
                     <ns3:result xsi:type="ns2:ReceivingTransaction" xmlns:ns2="http://xmlns.oracle.com/apps/scm/receiving/receipts/receivingTransaction/" xmlns:ns1="http://xmlns.oracle.com/apps/scm/receiving/common/protectedUiModel/flex/rcvTxn/" xmlns:ns3="http://xmlns.oracle.com/apps/scm/receiving/receipts/receivingTransaction/types/" xmlns:ns0="http://xmlns.oracle.com/adf/svc/types/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                        <ns2:TransactionId>238026</ns2:TransactionId>
                        <ns2:TransactionType>RETURN TO VENDOR</ns2:TransactionType>
                        <ns2:TransactionDate>2019-08-15T21:15:54.0Z</ns2:TransactionDate>
                        <ns2:Quantity unitCode="KPL" xmlns:tns="http://xmlns.oracle.com/adf/svc/errors/">1</ns2:Quantity>
                        <ns2:UOMCode>KPL</ns2:UOMCode>
                        <ns2:UnitOfMeasure>Each</ns2:UnitOfMeasure>
                        <ns2:Amount xsi:nil="true"/>
                        <ns2:CurrencyCode>EUR</ns2:CurrencyCode>
                        <ns2:ItemNumber>THAGT0003</ns2:ItemNumber>
                        <ns2:ItemId>300000005192585</ns2:ItemId>
                        <ns2:ShipmentLineId>189020</ns2:ShipmentLineId>
                        <ns2:ShipmentHeaderId>186017</ns2:ShipmentHeaderId>
                        <ns2:SourceDocumentCode>PO</ns2:SourceDocumentCode>
                        <ns2:DestinationTypeCode>RECEIVING</ns2:DestinationTypeCode>
                        <ns2:ParentTransactionId>212013</ns2:ParentTransactionId>
                        <ns2:ParentTransactionType>RECEIVE</ns2:ParentTransactionType>
                        <ns2:RootReceivingTransactionId>212013</ns2:RootReceivingTransactionId>
                        <ns2:POHeaderId>300000007821451</ns2:POHeaderId>
                        <ns2:POLineId>300000007821455</ns2:POLineId>
                        <ns2:POLineLocationId>300000007821456</ns2:POLineLocationId>
                        <ns2:PODistributionId>300000007821457</ns2:PODistributionId>
                        <ns2:OrganizationId>300000004023130</ns2:OrganizationId>
                        <ns2:OrganizationCode>KANTA</ns2:OrganizationCode>
                        <ns2:GroupId>242032</ns2:GroupId>
                        <ns2:ConsignedTransaction>N</ns2:ConsignedTransaction>
                        <ns2:SecondaryQuantity xsi:nil="true"/>
                        <ns2:SecondaryUOMCode xsi:nil="true"/>
                        <ns2:SecondaryUnitOfMeasure/>
                        <ns2:TransferOrderHeaderId xsi:nil="true"/>
                        <ns2:TransferOrderLineId xsi:nil="true"/>
                        <ns2:ReceiptAdviceLineNumber xsi:nil="true"/>
                        <ns2:SfoTransaction>Y</ns2:SfoTransaction>
                        <ns2:DropShipTransaction>N</ns2:DropShipTransaction>
                        <ns2:ScoTransaction>N</ns2:ScoTransaction>
                        <ns2:WORelatedPOSchedule>N</ns2:WORelatedPOSchedule>
                        <ns2:InventoryShipmentTransactionId xsi:nil="true"/>
                        <ns2:OrigShipmentInvTransactionId xsi:nil="true"/>
                        <ns2:ReceiptCreatedAgainstASN xsi:nil="true"/>
                        <ns2:RcvTxnDFFVA>
                           <ns1:TransactionId>238026</ns1:TransactionId>
                           <ns1:__FLEX_Context xsi:nil="true"/>
                           <ns1:__FLEX_Context_DisplayValue xsi:nil="true"/>
                           <ns1:_FLEX_NumOfSegments>0</ns1:_FLEX_NumOfSegments>
                        </ns2:RcvTxnDFFVA>
                     </ns3:result>
                  </ns0:findTransactionResponse>
               </env:Body>
            </env:Envelope>

            Thanks,

            Nagesh.

            • Kanchankumar Khedkar

              Hello Nagesh, 

              Please check below expression 

              <xpathExpr xmlns:ns2="http://xmlns.oracle.com/apps/scm/receiving/receipts/receivingTransaction/" xmlns:ns3="http://xmlns.oracle.com/apps/scm/receiving/receipts/receivingTransaction/types/">$eventPayload/ns3:result/ns2:OrganizationCode="KANTA"</xpathExpr>

              This filters events with OrganizationCode=KANTA - if it works then you can try - 

              <xpathExpr xmlns:ns2="http://xmlns.oracle.com/apps/scm/receiving/receipts/receivingTransaction/" xmlns:ns3="http://xmlns.oracle.com/apps/scm/receiving/receipts/receivingTransaction/types/">$eventPayload/ns3:result/ns2:TransactionType='RETURN TO VENDOR'</xpathExpr>

              OR

              <xpathExpr xmlns:ns2="http://xmlns.oracle.com/apps/scm/receiving/receipts/receivingTransaction/" xmlns:ns3="http://xmlns.oracle.com/apps/scm/receiving/receipts/receivingTransaction/types/">$eventPayload/ns3:result/ns2:TransactionType="RETURN TO VENDOR"</xpathExpr>

              Hope at least of this works. 

              Kanchan

    • Monish Munot

      Please try with

      <xpathExpr xmlns:ns_0="http://xmlns.oracle.com/adf/svc/types/" xmlns:ns_1="http://xmlns.oracle.com/apps/scm/receiving/receipts/receivingTransaction/" xmlns:ns_2="http://xmlns.oracle.com/apps/scm/receiving/receipts/receivingTransaction/types/">$eventPayload/ns_2:result/ns_0:Value/ns_1:TransactionType="RETURN TO VENDOR"</xpathExpr>

      • Nagesh Manda

        Hi Monish,

        After adding this expression i no longer ee the business events in OIC.

        Thanks,

        Nagesh

        • Monish Munot

          Probably transaction type value is not wrt filter; TransactionType="RETURN TO VENDOR;  so it is not received.

          • Nagesh Manda

            Hi Monish,

            I could see this field on the event received from SCM Cloud. I have already attached the event data in the post, do let me know if you need any more details.

            Thanks,

            Nagesh.

    • Monish Munot

      Payload is having "<ns2:TransactionType>RETURN TO RECEIVING</ns2:TransactionType>".

      If you want to receive the given payload, we need update the filter to,

      <xpathExpr xmlns:ns_0="http://xmlns.oracle.com/adf/svc/types/" xmlns:ns_1="http://xmlns.oracle.com/apps/scm/receiving/receipts/receivingTransaction/" xmlns:ns_2="http://xmlns.oracle.com/apps/scm/receiving/receipts/receivingTransaction/types/">$eventPayload/ns_2:result/ns_0:Value/ns_1:TransactionType="RETURN TO RECEIVING"</xpathExpr>

      • Nagesh Manda

        Hi Monish,

        There is also another row in the file with the TransactionType as RETURN TO VENDOR

        Thanks,

        Nagesh.

        • Monish Munot

          Please try with,

          <xpathExpr xmlns:ns_0="http://xmlns.oracle.com/adf/svc/types/" xmlns:ns_1="http://xmlns.oracle.com/apps/scm/receiving/receipts/receivingTransaction/" xmlns:ns_2="http://xmlns.oracle.com/apps/scm/receiving/receipts/receivingTransaction/types/">$eventPayload//ns_0:Value/ns_1:TransactionType='RETURN TO VENDOR' or  $eventPayload//ns_0:Value/ns_1:TransactionType='RETURN TO RECEIVING'</xpathExpr>

          • Nagesh Manda

            Hi Monish,

            It didnt work and i was unable to see the message received in OIC.

            Thanks,

            Nagesh.

            • Monish Munot

              Couple of observations -

              1. Ideally you should receive only one transaction in such a event, I believe.
              2. Can you remove the filter condition and grab the payload again and share?
              3. Following expression is working for me in all environments.

              <xpathExpr xmlns:ns0="http://xmlns.oracle.com/apps/scm/productModel/items/itemServiceV2/types/" xmlns:ns1="http://xmlns.oracle.com/apps/scm/productModel/items/itemServiceV2/" xmlns:ns3="http://xmlns.oracle.com/adf/svc/types/">$eventPayload/ns0:result/ns3:Value/ns1:OrganizationCode='ITEMORG'</xpathExpr>

              • Nagesh Manda

                Hi Monish,

                1. Ideally you should receive only one transaction in such a event, I believe. - There are always 2 transactions sent out for a supply return transaction ( DELIVER and RECIVE)
                2. Can you remove the filter condition and grab the payload again and share? - The payload is already attached to the post
                3. Following expression is working for me in all environments. - yes i have tried with item service is fine but this seems to be peculiar issue and the syntax doesnt seem to be working.
                • Monish Munot

                  Following is last one I can think of with indexes, though it is not recommended.

                  <xpathExpr xmlns:ns0="http://xmlns.oracle.com/adf/svc/types/" xmlns:ns1="http://xmlns.oracle.com/apps/scm/receiving/receipts/receivingTransaction/" xmlns:ns2="http://xmlns.oracle.com/apps/scm/receiving/receipts/receivingTransaction/types/">$eventPayload/ns2:result[1]/ns0:Value/ns1:TransactionType='RETURN TO RECEIVING' or  $eventPayload/ns2:result[2]/ns0:Value/ns1:TransactionType='RETURN TO VENDOR'</xpathExpr>

    • Jihane

      Hi Nagesh,

      try below one, always avoid using a double quote, use simple quote instead. Maybe because of the namespace. It works for me.

      1- 

      <xpathExpr xmlns:nssrcmpr='http://xmlns.oracle.com/adf/svc/types/' xmlns:nsmpr4='http://xmlns.oracle.com/apps/scm/receiving/receipts/receivingTransaction/' xmlns:inp1='http://xmlns.oracle.com/apps/scm/receiving/receipts/receivingTransaction/types/'>$eventPayload/inp1:result/nsmpr4:TransactionType='RETURN TO VENDOR'</xpathExpr>

      2- 

      <xpathExpr xmlns:ns0='http://xmlns.oracle.com/adf/svc/types/' xmlns:ns2='http://xmlns.oracle.com/apps/scm/receiving/receipts/receivingTransaction/' 
      xmlns:ns3='http://xmlns.oracle.com/apps/scm/receiving/receipts/receivingTransaction/types/'>$eventPayload/ns3:result/ns2:TransactionType='RETURN TO VENDOR'</xpathExpr>
      • Nagesh Manda

        Thanks Jima.

        I have tried both the options and the filter doesnt seem to be working as i can see both the transactions.

        Regards,

        Nagesh.

    • Jihane
      Hi Nagesh, 1- r u trying to call your OIC integration from a client tool such as SOAPUI ? Or 2- your OIC intevration is triggered from oracle cloud (SaaS)? 3- what's your OIC version 4- are you able to share the .iar integration with us.
    • Nagesh Manda

      Hi All,

      Kindly find the update from Oracle Development team below.

      Within a single event payload, customer will receive two instances of "Transaction".
      Customer's requirement is to receive the business event when the transaction type in one of the 'transaction' elements = 'RETURN TO VENDOR' .

      The following filter expression was shared with the customer in the OWC.

      <xpathExpr
      xmlns:ns2="http://xmlns.oracle.com/apps/scm/receiving/receipts/receivingTransaction/"
      xmlns:ns3="http://xmlns.oracle.com/apps/scm/receiving/receipts/receivingTransaction/types/" > ($eventPayload/ns3:result[1]/ns2:TransactionType='RETURN TO VENDOR') OR ($eventPayload/ns3:result[2]/ns2:TransactionType='RETURN TO VENDOR')
      </xpathExpr>

      The event payload is now reaching the OIC with the above XPath expression.

      Customer is also expecting the event payload to have just a single instance of "Transaction" where the transaction type = 'RETURN TO VENDOR' .

      This is something not possible as the SOA/EHF would not strip off the one of the Transaction elements from the event payload where the transaction type
      is NOT equal to 'RETURN TO VENDOR' . EHF does not tamper with the event payload.

      Instead, Dev suggested the customer to strip off the unwanted 'transaction' element from the event payload at the integration level.

       

      • Kanchankumar Khedkar

        Thanks for update. 

      • Monish Munot

        This update helps! However you can manage this in integration itself at the start and only issue could be you would have many instances in the integration layer. And to avoid this possibly you can

        1. Create 2 integrations where one is to receive --> filter the data
        2. Do the further operations on the data so that it would be easy to monitor and maintain.

        Hope this helps.