DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • How To Get Cell Data From an Excel Spreadsheet Using APIs in Java
  • Enterprise RIA With Spring 3, Flex 4 and GraniteDS
  • Migrating Spring Java Applications to Azure App Service (Part 1: DataSources and Credentials)
  • How To Build Web Service Using Spring Boot 2.x

Trending

  • Kafka and Spark Structured Streaming in Enterprise: The Patterns That Hold Up Under Pressure
  • Building a Spring AI Assistant With MCP Servers: A Step-by-Step Tutorial
  • Genkit Middleware: Intercept, Extend, and Harden your Gen AI Pipelines
  • 5 Layers of Prompt Injection Defense You Can Wire Into Any Node.js App
  1. DZone
  2. Coding
  3. Java
  4. OFX4J: Java Web Service APIs for Interfacing with Financial Institutions

OFX4J: Java Web Service APIs for Interfacing with Financial Institutions

By 
Ryan Heaton user avatar
Ryan Heaton
·
Jul. 22, 08 · News
Likes (0)
Comment
Save
Tweet
Share
3.8K Views

Join the DZone community and get the full member experience.

Join For Free

OFX4J has been released!

OFX4J is a Java implementation of Open Financial Exchange, which defines web service APIs for interfacing with financial institutions. The OFX4J library includes support for both client-side and server-side implementations of both version 1 and version 2 of the OFX specification.

As an example, let's consider the OFX4J client-side interface, which can be used, for example, to download your financial transactions from your bank or credit card institution. OFX4J comes with an initial set of financial institution data, but you can load your own if your financial institution isn't included.

Consider the following code for downloading your bank statement:

//the financial institution data is loaded or created
//the FinancialInstitutionData interface defines
//what is required to interface with a financial institution.
FinancialInstitutionData data = ...;
FinancialInstitutionService service
= new FinancialInstitutionServiceImpl();
FinancialInstitution fi = service.getFinancialInstitution(data);

//get a reference to a specific bank account at the FI
BankAccountDetails bankAccountDetails
= new BankAccountDetails();

//routing number to the bank.
bankAccountDetails.setRoutingNumber("11111111");
//bank account number.
bankAccountDetails.setAccountNumber("1234-5678");
//it's a checking account
bankAccountDetails.setAccountType(AccountType.CHECKING);

BankAccount bankAccount
= fi.loadBankAccount(bankAccountDetails, "username", "password");

//read the statement (transaction details, etc.)
// for a given time period.
Date startDate = ...;
Date endDate = ...;
AccountStatement statement
= bankAccount.readStatement(startDate, endDate);

// get a reference to a specific credit card
// account at your FI
CreditCardAccountDetails ccDetails
= new CreditCardAccountDetails();
ccDetails.setAccountNumber("1234-567890-1111");
CreditCardAccount ccAccount
= fi.loadCreditCardAccount(ccDetails, "username", "password");

// read the statement (transaction details, etc.)
// for a given time period.
Date startDate = ...;
Date endDate = ...;
AccountStatement statement
= ccAccount.readStatement(startDate, endDate);

Server-side development is just straightforward, consisting of implementing a simple interface and publishing it with a simple Servlet implementation:

/**
* Basic interface for an OFX server.
*
* @author Ryan Heaton
*/
public interface OFXServer {

/**
* Get a response for the given request.
*
* @param request The request.
* @return The response.
*/
ResponseEnvelope getResponse(RequestEnvelope request);
}

 

 

Web Service Java (programming language)

Opinions expressed by DZone contributors are their own.

Related

  • How To Get Cell Data From an Excel Spreadsheet Using APIs in Java
  • Enterprise RIA With Spring 3, Flex 4 and GraniteDS
  • Migrating Spring Java Applications to Azure App Service (Part 1: DataSources and Credentials)
  • How To Build Web Service Using Spring Boot 2.x

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook