Calculate Total Balance

Use this recipe to calculate the total balance for a group of credit cards using the for each action, and log the result to the activity stream.

Note:

This recipe is available as Oracle Soap Library Calculator ForLoop in the Integration Store. Oracle provides this recipe as a sample only. The recipe is meant only for guidance, and is not warranted to be error-free. No support is provided for this recipe.

Overview

The integration in this recipe iterates through an array of credit cards using the for each action, and calculates the total balance.

The integration receives an array of credit cards in the SOAP request, and then calculates and logs the total balance for all the credit cards in the array.

It uses the JavaScript library Oracle-Library-Calculator to add up the total balance, and the logger action to log the result.

The integration that results from installing this recipe is named: Oracle Soap Library Calculator ForLoop.

To run this integration the input you provide must use WS-Security UsernameToken authentication and specify a user, a password, a token, and a time stamp. Use the user and password that you use to access your Oracle Integration instance.

Input Example

<soapenv:Envelope xmlns:aut="http://www.autoloan.com/ns/autoloan" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header>
      <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
         <wsu:Timestamp wsu:Id="TS-A0B5B6EE369353695016143639393465">
            <wsu:Created>2021-02-26T18:25:39.346Z</wsu:Created>
            <wsu:Expires>2021-02-26T18:26:39.346Z</wsu:Expires>
         </wsu:Timestamp>
         <wsse:UsernameToken wsu:Id="UsernameToken-A0B5B6EE369353695016143635403723">
            <wsse:Username>your_user_name</wsse:Username>
            <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">password</wsse:Password>
            <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">lyzXqn9Ai17AyC/n+5pDpA==</wsse:Nonce>
            <wsu:Created>2021-02-26T18:19:00.372Z</wsu:Created>
         </wsse:UsernameToken>
      </wsse:Security>
   </soapenv:Header>
   <soapenv:Body>
      <aut:creditCards>
         <!--1 or more repetitions:-->
         <aut:CreditCard>
            <aut:CARD_NUMBER>5105 1051 0510 5100</aut:CARD_NUMBER>
            <aut:BALANCE>151</aut:BALANCE>
            <aut:LOAN_AMOUNT>100</aut:LOAN_AMOUNT>
            <aut:CREDIT_RATE>4</aut:CREDIT_RATE>
         </aut:CreditCard>
         <aut:CreditCard>
            <aut:CARD_NUMBER>3782 8224 6310 005</aut:CARD_NUMBER>
            <aut:BALANCE>94</aut:BALANCE>
            <aut:LOAN_AMOUNT>80</aut:LOAN_AMOUNT>
            <aut:CREDIT_RATE>4</aut:CREDIT_RATE>
         </aut:CreditCard>
         <aut:CreditCard>
            <aut:CARD_NUMBER>3530 1113 3330 0000</aut:CARD_NUMBER>
            <aut:BALANCE>37</aut:BALANCE>
            <aut:LOAN_AMOUNT>20</aut:LOAN_AMOUNT>
            <aut:CREDIT_RATE>4</aut:CREDIT_RATE>
         </aut:CreditCard>
      </aut:creditCards>
   </soapenv:Body>
</soapenv:Envelope>

Output Example

This image shows the logged message in the activity stream. The total balance for this example is 282.


The image is described in the surrounding text.

System and Access Requirements

  • Oracle Integration

Install, Configure, and Run the Recipe

For more information and steps to install, configure, and run recipes, see Get Started with Integration Accelerators and Recipes.

Before you run the integration created with this recipe, you must configure the connection to the SOAP service:

To create a connection to the SOAP service, follow the steps described in Create a SOAP Adapter Connection in Using the SOAP Adapter with Oracle Integration.

Related Documentation

To learn more about the adapters used in this recipe, see Using the SOAP Adapter with Oracle Integration.