IContext and IConnection Objects
A business service public method must contain two objects, IContext and IConnection, as part of its signature. The IContext object provides the default connection for the business function call and holds an identifier that ties together all processing for the business service. The IConnection object enables the business service method to be run under an explicit transaction; and if the connection is null, the default transaction is used. The context and connection objects are passed to the public methods of the business service class, which in turn passes these objects to any of the methods that call a business function. To indicate the boundaries of the internal method, business service public methods must call the inherited methods, startInternalMethod(context, "methodName", valueObject) before any other logic and finishInternalMethod(context, "methodName", valueObject) when all other processing is finished.
This code sample shows how to use IContext and IConnection:
public static E1MessageList addAddressBook(IContext context, IConnection connection, InternalAddAddressBook internalVO){ //call start internal method, passing the context (which was //passed from published business service) startInternalMethod(context, "addAddressBook",internalVO); ... // calls method which then executes BSFN AddressBookMBF E1MessageList messages = callAddressBookMasterMBF (context,connection, internalVO, programId); ... // call finish internal method passing context finishInternalMethod(context, "addAddressBook"); //return status code from BSFN call ... return messages; }