Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


...

Inquiries:
getAccountBalance will retrieve the available account balance for one account.
Optional – chartOfAccountsCode (Default 'UC')
Required – account number

...

Page Properties


Service NameaccountBalanceInquiry
DescriptionProvides the available balance for a given chart of accounts and account number.

...

API Type

REST (changed from SOAP) - FinancialWebAPI (January, 2022)

Status

Status
colourGreen
titlecomplete

Release Date

 

Last Update

 KFS Version 3.32.0

Notes


URL

Sample Response



<accountBalance>

<accountBalance>-80.85</accountBalance>

</accountBalance>




Criteria Used for Balance Checking:

...


Calculation:
Available Balance = (BudgetAmount – ActualsAmount – EncumbranceAmount)Sample code for retrieving a Single Account:
SOAP:
<soapenv:Envelope

WSDL Definition

Operations

NameDescriptionInput
getAccountBalance

Will retrieve the available account balance for one account.

chartOfAccountsCode [Default 'UC'] (Optional)
account number (Required)

Response

AttributeDescriptionValues
accountBalance

The Account Balance

999999.99

Sample Request XML (SOAP)

Code Block
languagexml
titleSample Request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v5="http://kfs.kuali.org/core/v5_0">

...


	<soapenv:Header/>

...


	<soapenv:Body>

...


		<v5:getAccountBalance>

...


			<!-Optional:->

...


			<arg0>
				<chartOfAccountsCode></chartOfAccountsCode>

...


				<accountNumber>5612710</accountNumber>

...


			</arg0>

...


		</v5:getAccountBalance>

...


	</soapenv:Body>

...


</soapenv:Envelope>

Sample

...

Response XML - SOAP (Good)

Code Block
languagexml
titleSample Response XML (Good)
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

...


	<soap:Body>

...


		<ns2:getAccountBalanceResponse xmlns:ns2="http://kfs.kuali.org/core/v5_0">

...


			<return>
				<accountBalance>10955.85</accountBalance>

...


			</return>

...


		</ns2:getAccountBalanceResponse>

...


	</soap:Body>

...


</soap:Envelope>

Sample Response XML - SOAP (Bad)

Code Block
languagexml
titleSample Response (Bad

...

)
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

...


	<soap:Body>

...


		<soap:Fault>

...


			<faultcode>soap:Server</faultcode>

...


			<faultstring>Invalid/empty Account Parameter.</faultstring>

...


			<detail>
				<ns2:AccountInquiryFault xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="http://kfs.kuali.org/core/v5_0"/>

...


			</detail>

...


		</soap:Fault>

...


	</soap:Body>

...


</soap:Envelope>

Code Examples

  • Java

    Code Block
    languagejava
    titleJUnit
    package com.example.coa.service;
    
    import javax.xml.bind.JAXBElement;
    
    import org.junit.Test;
    import org.kuali.kfs.core.v5_0.GetAccountBalanceResponse;
    import org.springframework.oxm.jaxb.Jaxb2Marshaller;
    
    import junit.framework.TestCase;
    
    public class AccountBalanceInquiryServiceTest extends TestCase {
    
        @Test
        public void testGetAccounts() throws Exception {
    
        	String chartOfAccountsCode = "UC";
            String accountNumber = "5612710";
                    
            AccountBalanceInquiryServiceClient client = new AccountBalanceInquiryServiceClient();
            
            Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
            marshaller.setContextPath("org.kuali.kfs.core.v5_0");
            client.setMarshaller(marshaller);
            client.setUnmarshaller(marshaller);
              
            JAXBElement<GetAccountBalanceResponse> response = client.getAccountBalance(chartOfAccountsCode, accountNumber);
    
            assertNotNull(response);
        }
    
    }


    Code Block
    languagejava
    titleClient
    package com.example.coa.service;
    
    import java.io.StringWriter;
    
    import javax.xml.bind.JAXBContext;
    import javax.xml.bind.JAXBElement;
    import javax.xml.transform.Result;
    import javax.xml.transform.stream.StreamResult;
    
    import org.kuali.kfs.core.v5_0.AccountBalanceInquiryRequest;
    import org.kuali.kfs.core.v5_0.GetAccountBalance;
    import org.kuali.kfs.core.v5_0.GetAccountBalanceResponse;
    import org.springframework.oxm.Marshaller;
    import org.springframework.ws.client.core.support.WebServiceGatewaySupport;
    
    public class AccountBalanceInquiryServiceClient extends WebServiceGatewaySupport {
    
        public JAXBElement<GetAccountBalanceResponse> getAccountBalance(String chartOfAccountsCode, String accountNumber) throws Exception {
        	
            String uri = "https://kualinp.uconn.edu/kfs-dev/remoting/accountBalanceInquiry";
            GetAccountBalance request = new GetAccountBalance();
            AccountBalanceInquiryRequest accountBalanceInquiryRequest = new AccountBalanceInquiryRequest();
            accountBalanceInquiryRequest.setChartOfAccountsCode(chartOfAccountsCode);
            accountBalanceInquiryRequest.setAccountNumber(accountNumber);
            request.setArg0(accountBalanceInquiryRequest);
            
            logXml(request);
            
            Object object =  getWebServiceTemplate().marshalSendAndReceive(uri, request);
            
            logXml(object);
            
            return (JAXBElement<GetAccountBalanceResponse>) object;
        }
    
        public void logXml(Object element) {
    
            try {
                JAXBContext jc = JAXBContext.newInstance(element.getClass());
                Marshaller marshaller = getMarshaller();
                StreamResult result = new StreamResult(new StringWriter());
                marshaller.marshal(element, result);
                System.out.println("XML : " + result.getWriter().toString());
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }