EAI Siebel Adapter Business Service Example
The following example uses the generated code for the EAI Siebel Adapter business service. An instance is instantiated using the constructor that takes an instance of SiebelDataBean. The QueryPage method is called; its output is actually an Account Interface integration object, but the object returned is not strongly typed and instead is used to construct an Account Interface instance. The generated code for Account Interface is also needed for this example.
import com.siebel.data.SiebelDataBean;
import com.siebel.data.SiebelException;
import com.siebel.local.accountinterface.Account_InterfaceIO;
import com.siebel.local.accountinterface.AccountIC;
import com.siebel.service.jdb.eaisiebeladapter.EAI_Siebel_AdapterBusServAdapter;
import com.siebel.service.jdb.eaisiebeladapter.QueryPageInput;
import com.siebel.service.jdb.eaisiebeladapter.QueryPageOutput;
public class DataBeanDemo {
public static void main(String[] args) throws SiebelException {
SiebelDataBean m_dataBean = new SiebelDataBean();
String conn = "siebel://examplecomputer:2321/siebel/SCCObjMgr_enu";
m_dataBean.login(conn, "USER", "PWD", "enu");
// Construct the EAI Siebel Adapter, using the data bean
EAI_Siebel_AdapterBusServAdapter svc =
new EAI_Siebel_AdapterBusServAdapter(m_dataBean);
svc.initialize();
try {
// Set values of the arguments to the QueryPage method.
QueryPageInput qpInput = new QueryPageInput();
qpInput.setfPageSize(Integer.toString(10)); // Return 10 records.
qpInput.setfOutputIntObjectName("Account Interface");
qpInput.setfStartRowNum(Integer.toString(0)); // Start at record 0.
QueryPageOutput qpOutput = svc.mQueryPage(qpInput);
// Construct the integration object using the QueryPage output
Account_InterfaceIO acctIO =
new Account_InterfaceIO(qpOutput.getfSiebelMessage().toPropertySet());
// Convert the results to a vector for processing
Vector ioc = acctIO.getfintObjInst();
// Print name of each account
if (!ioc.isEmpty()) {
for (int i = 0; i < ioc.size(); i++) {
AccountIC acctIC = ((AccountIC) ioc.get(i));
System.out.println(acctIC.getfName());
}
}
}
catch (SiebelException e) {}
finally {
m_dataBean.logoff();
}
}
}