The FEX Java API provides tools to perform tasks on the EBICS Server. These tools enable you to:
The FEX Java API is delivered in the FEX installation package, in the form of a ZIP file.
The file is located in the FEX installation package at:
\EbicsServer_VX.X.X\binaries\FEX-Java-Api-X.X.X.zip
Copy the file FEX-Java-Api-X.X.X.zip from the FEX installation package to your local machine, and unzip the file.
After you unzip the package you obtain the following folders:
To use the EBICS Java API, execute the following steps:
|
generalProcess() { /* Define Configuration object */ Configuration configuration = new Configuration("localhost", 1099, ConnectionType.JBOSS, "admin", "start".toCharArray()); EbicsApi api = EbicsApi.getInstance();
/* Initialize API */ api.init(configuration, "myuser");
/* Start Configuration object */ Transaction transaction = api.getContext("myuser").startTransaction(); try { System.out.println("Create a new bank"); /* Create new bank TEST */ Bank bank = new Bank(); bank.setName("TEST"); bank.setHostid("TEST"); bank.setLongIds(true); bank.setHashValidationLength(1); bank.setUrl("https://localhost:8443/ebics/EbicsServlet"); bank.setEbicsHostId("TEST");
/* Persist new bank TEST */ BankManager.getInstance().persist(bank, cp);
/* Confirm the current transaction */ api.getContext("myuser").terminateTransaction(transaction); System.out.println("Operation successful."); } catch (Exception e) { /* Cancelled the transaction */ api.getContext("myuser").cancelTransaction(transaction); System.out.println("Operation failed."); } } |
| For the variable | Type | Enter |
|---|---|---|
| Hostname | String | The host name or IP address of the EBICS Server. |
| Port | Integer | Port of the bootstrap. |
| ConnectionType | Enumeration | The type of EBICS Server (JBoss, WebSphere, WebLogic). |
| login | String | The login of the user used to connect to EBICS Server. |
| Password | Array of char | The password of the user used to connect to EBICS Server. |
| For the variable | Type | Enter |
|---|---|---|
| configuration | Configuration | Instance of the configuration object. |
| userId | String | The identifier of the connection. |
After you unzip the API delivery package on your machine, the following sample files are available in the folder:
samples\com\axway\fex\ebics\sample:
| Classes | Description |
|---|---|
| ReleaseKey.java | Releases a key. |
| SampleAccount.java |
Creates an account entity with its properties (IBAN, Code BIC …). Deletes an account. Updates account properties. Finds an account by IBAN. |
| SampleBank.java |
Creates a bank entity with its properties (Name, Host-Id …). Deletes a bank and dependent entities. Updates bank properties. Finds a bank by name or host-id. |
| SampleCustomer.java |
Creates a customer entity with its properties (Name, City, Street …). Associates accounts and order types. Deletes a customer and the dependent entities. Updates Customer properties. Finds a customer by name. Returns the list of account and associated order types. |
| SampleOrderType.java |
Creates fetch and send entities with their properties (Name, handler …). Deletes the objects. Updates the entity object properties. Finds the entity objects by name. |
| SampleUser.java |
Creates a user entity with its properties (Name, Mail, City …). Associates accounts and order types. Deletes a user. Updates user properties. Finds a user by name. This object can also return the list of accounts and associated order types. Contains functions to compare and release the certificates. |
Set your classpath to include the following JAR files:
Before you can use the Java API in a WebSphere or WebLogic environment, you must perform some additional configuration steps. For details, see Specific application server configuration.
After you set the classpath, from the \samples directory, enter the following command:
javac -d . com/axway/fex/ebics/sample/*.java
This command generates class files in the directory: com/axway/fex/ebics/sample.
To run samples, navigate to the samples directory and enter the following command:
UNIX:
java -cp .:$CLASSPATH com.axway.fex.ebics.sample.XXXX
WINDOWS:
java -cp .;%CLASSPATH% com.axway.fex.ebics.sample.XXXX
Where: XXXX is the name of the sample.
If you are using the API in a WebLogic environment, add the following VM arguments:
-Dweblogic.jndi.enableDefaultUser=true -Dsun.lang.ClassLoader.allowArraySyntax=true
The command line is then:
java -Dweblogic.jndi.enableDefaultUser=true -Dsun.lang.ClassLoader.allowArraySyntax=true -cp .;%CLASSPATH% com.axway.fex.ebics.sample.XXXX
Where: XXXX is the name of the sample.
Specific application server configuration