Why an SDK?
Introduction to FBI SDK Programming
The Communication Model
Creating your first integrated application
Tools
Versions
Contents |
Your integrated application will be using the Client Server Model to communicate with the Fishbowl Server. In this model the Client (your integrated application) will send requests to the Server which will then process those requests and send back the response.
The first time that an integrated application tries to log onto the server it will need to be approved. This will need to be done by the Fishbowl sytem administrator. Once the application has been approved it may begin sending requests to the server using one of the two methods outlined below. While the integrated application is logged into the server it uses a license just like the Fishbowl Inventory Client.
Once a socket has been opened and the integrated application has been accepted by the server, the integrated application can begin sending FBXML requests to the server to be processed. See the FBXML schema documentation for valid requests.
When using the FBXML interface, each response from the server will contain a key which the integrated application will need to store and use for the next request it sends. This key will change after each request is sent. A request with an invalid key will not be processed. This is done to improve the security of the connection between the integrated application and the Fishbowl server.
The Java Application Programming Interface (JAPI) allows the development of an integrated application without having to deal with the actual FBXML statements. While JAPI does use FBXML it handles it behind the scenes.
Creating your first integrated application
All integrated applications need to follow these basic steps:
Create a connection to the server and login.
Send requests to the server and process the responses.
Close the connection to the server.
Remember that the first time your integrated application tries to login to the server it must be approved by the Fishbowl system administrator before the server will begin processing requests.
All integrated applications need a Name, Description, and an Application Key. The Name and Description will be used to identify the integrated application when it logs into the server. The Application Key is a unique integer value that is used to help distinguish the integrated application from other integrated applications. Before you release your integrated application please contact technical support (or the Fishbowl Developer's Network) to verify that the Application Key being used in your new integrated application is not already in use by another integrated application.
For our first integrated application we're going to create a simple application that displays the contents of a tag. We will create the application first using FBXML and then using JAPI. Both of these examples will be done in Java. For the sake of simplicity, all input and output will be through the console.
See TagInfoXML.java for the full source code.
The first thing that needs to be done is to open a socket connection to the server and to create the input and output streams.
The integrated application now needs to send a login request to the server.
Note: The user password needs to be encrypted using MD5 before sending it over to the server.
Each response will contain a statusCode that is used to determine the result of the request. After sending the login request the integrated application should verify that the login was successfully made.
Note: The first time that the integrated application tries to log into the server it will register itself with the status of pending. The system administrator will need to approve the integrated application before it will be able to successfully login to the server.
On a successful login the integrated application needs to store the ticket key for the next request. All responses contain a Ticket element which holds a Key element. The key will change after each request is processed and it is the responsibility of the client application to handle the key management.
Once the integrated application has successfully logged into the server it can begin sending requests to be processed.
When the integrated application is finished sending requests to the server and processing the responses it needs to close the input stream, the output stream, and the socket connection to logoff of the server.
See TagInfoJAPI.java for the full source code.
The first thing that needs to be done when creating a JAPI integrated application is to create a transport manager that will handle the messages that are sent between the server and the application.
TransportManager transportManager = TransportFactory.getTransportManager();
transportManager.openConnection(IA_NAME, IA_DESC, IA_KEY, "localhost", 28192);
And then to log into the server.
transportManager.login(userName, userPwd);
Note: The user password will automatically be encrypted before it is sent over to the server.
The integrated application is now ready to do its work. To get objects from the server the application makes function calls on a manager.
InventoryManager invMan = JapiFactory.getInventoryManager();
Tag tag = invMan.getTag("121");
When the integrated application is finished it only needs to make one call to the transport manager to log off of the server.
transportManager.logout();
The following files, found in the lib directory, need to be in the classpath:
fbsdk-4.6.jar
castor-0.9.5.2.jar
commons-logging-1.0.4.jar
jakarta-oro.jar
djom-1.0.jar
mail-1.4.jar
spring-beans-1.2.5.jar
spring-context-1.2.5.jar
spring-core-1.2.5.jar
xerces-J_1.4.0.jar