Troubleshooting
Problem
Using custom APIs code sample for invoking, configuration needed, connection fundamentals
Resolving The Problem
Let us say you have configured a custom api to use a class called com.yantra.AnandApi, with a method call anandMethod.
1. anandMethod should have the following signature
public Document anandMethod (YFSEnvironment env, Document inDoc)
2. Let us say you want to call an api from anandMethod. This is how your code will look like:
public Document anandMethod (YFSEnvironment env, Document inDoc) {
YIFApi api = YIFClientFactory.getInstance().getLocalApi();
// If you are using 4.0 and not 4.0 sp1 ,uncomment the following two
// lines
// env.setAdapterName("DefaultAdapter");
// env.setSystemName("DefaultSystem");
// to call a system api
api.createOrder(env, <your document>)
// If you want to access a custom method called myApi in some other HTTP/EJB
// communication group from within anandMethod , you need to do this:
env.setAdapterName("MyCommGroup");
env.setSystem("MySystem")
api.invoke(env, "myApi", <yourDoc>
3. If you want to access the database and do sql operations you need to do something like this:
com.yantra.yfs.japi.YFSConnectionHolder connHolder = (com.yantra.yfs.japi.YFSConnectionHolder) env;
java.sql.Connection conn = connHolder.getDBConnection();
java.sql.Statement sql = conn.createStatement();
sql.executeQuery("your sql");
Make sure that you DO NOT commit or rollback on this connection.
Read the javadocs of com.yantra.yfs.japi.YFSConnectionHolder interface for more information.
For database connections do not close the connection. The connection that resides in the YFSConnectionHolder is used by the entire transaction. Interop will close it. (in the future, we plan to give a proxy for the connection , which will throw an exception when a commit, rollback or close is called on it)
[{"Type":"MASTER","Line of Business":{"code":"LOB77","label":"Automation Platform"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SS6PEW","label":"IBM Sterling Order Management System Software"},"ARM Category":[{"code":"a8m0z000000cy00AAA","label":"Orders"}],"ARM Case Number":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"10.0.0;9.0.0;9.1.0;9.2.0;9.2.1;9.3.0;9.4.0;9.5.0"}]
Historical Number
PRI48529
Product Synonym
IBM Sterling OMS
Was this topic helpful?
Document Information
Modified date:
25 June 2025
UID
swg21540113