No description or website provided.

Welcome to OFX4J!

This project provides an implementaion of OFX for Java.

Build Status




OFX Client

Lookup Your Financial Institution

You have to first find the financial institution you want to interface with. Use an implementation of com.webcohesion.ofx4j.client.FinancialInstitutionDataStore to list the available financial institution data. Alternatively, use com.webcohesion.ofx4j.client.impl.BaseFinancialInstitutionData to construct your own data if your FI data isn't available.

The two default implementations of FinancialInstitutionDataStore are com.webcohesion.ofx4j.client.impl.LocalResourceFIDataStore and com.webcohesion.ofx4j.client.impl.OFXHomeFIDataStore. The former looks up the data store list from a local resource (default is the list at /META-INF/ofx4j/institutions.xml on the classpath; a default one is packaged with the jar). The latter screen-scrapes this page at OFX Home, so it's subject to break depending on how often the format of that page changes.

Once you have a reference to the FinancialInstitutionData you want, you can now use it to interface with your FI.

Interfacing With Your Financial Institution

FinancialInstitutionData data = ...;
FinancialInstitutionService service
  = new FinancialInstitutionServiceImpl();
FinancialInstitution fi = service.getFinancialInstitution(data);

// read the fi profile (note: not all institutions
// support this, and you normally don't need it.)
FinancialInstitutionProfile profile = fi.readProfile();

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

//routing number to the bank.
//bank account number.
//it's a checking account

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();
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);

OFX Server

You can use OFX4J to implement your own OFX server. To do so, you must implement the com.webcohesion.ofx4j.server.OFXServer interface. Once an adequate implementation of this interface is exists, you can use the com.webcohesion.ofx4j.server.OFXServlet in your J2EE application, passing the name of the OFXServer implementation in the "ofx-server-class" init parameter.



    <!-- uncomment to use OFX v2






Reading OFX data

OFX4J boasts a very fast, event-based OFX reading mechanism. If you've got a file or other stream resource, you can read it using an instance of We suggest the, which uses utilities provided by the NanoXML project. This reader will detect the version of OFX being used (version 1 or 2) and parse it accordingly.

Or you want to unmarshal the OFX directly to a Java object, use the

Writing OFX data

You can also write OFX data using an instance of is used to write OFX version 1 and is used to write OFX version 2. If you want to marshal from Java objects, use the


Try the issue tracker.