Calling an external BO API from my J2EE Application

Discussions

General J2EE: Calling an external BO API from my J2EE Application

  1. We have an application which contains a module that handles User Creation and Maintenance. Right now we have New and Authorize screens. Basically these users can access reports in BO. But this user creation in BO(Bussiness Objects) is done manually in BO. Now I need to automate this user creation in BO from my UserMaintenance Module. BO has exposed an API thru which we can call functions to create an User in BO. My problem is where to call this API from ?We call a stored procedure for authorizing a new user in UserMaintenace Module. We use Struts Framework. Action class--->ServiceClass-----> DAOClass In this DAO class we call this stored procedure to authorize the user creation. My question is where to call this API from . That is ,it should be called from DAO or ACtion class or Service class. How to call an external API and what are the issues that are generally involved in calling an external API. Fortunately both my weblogic and BO servers reside on the same unix server. While calling an API should I have to take care about Portnumbers,external machine location i.e host address, How to handle database connection. Can someone throw an answer to these questions. Thanks in advance
  2. If you are using Oracle, you can invoke your external API interfaces within your Java stored procedures, which I believe would be a good approach in your case, as if there are any issues yopu can roll back the transaction within your Oracle java stored Proc. The other way is to start a transaction in your Java Service classs or DAO, and remove the transaction commit/ roll over logic from your stored proc. After Startingg the Transaction within your Java code, execute your stored proc, and then the BO api (the sequence must be execute the stored proc first and then only your BO API), and if everything goes fine, commit the transaction so the Local DB changes are effected. If anything goes wrong with The BO API, you can roll back your Transaction, ie the stored procedure's DB transaction, where as If something went wrong with your stored proc call you may not be able to roll back your BO API transaction, hence the order of invocation is Stored proc, then BO , both within the transaction Scope of the stored proc call .