Siebel Account Business Service Example
The following is a code sample invoking the QueryByExample method of the Siebel Account business service. In addition to the generated code for Siebel Account (resident in com.siebel.service.jdb.siebelaccount), the sample uses the generated code for the Account Interface integration object (resident in com.siebel.local.accountinterface).
The code invokes the QueryByExample method of the Siebel Account business service. The parameter to this method is formed from an instance of the Account Interface integration object, which serves as the example, essentially specifying a search criterion of all accounts that start with the letters Ai. The output integration object is converted to a Vector and iterated through to print the names of matching accounts.
import com.siebel.data.SiebelDataBean;
import com.siebel.data.SiebelException;
import com.siebel.service.jdb.siebelaccount.Siebel_AccountBusServAdapter;
import com.siebel.service.jdb.siebelaccount.QueryByExampleInput;
import com.siebel.service.jdb.siebelaccount.QueryByExampleOutput;
import com.siebel.local.accountinterface.Account_InterfaceIO;
import com.siebel.local.accountinterface.AccountIC;
public class JDBSiebelAccount {
public static void main(String[] args) throws SiebelException {
Siebel_AccountBusServAdapter svc = new Siebel_AccountBusServAdapter("USER",
"PWD","siebel://examplecomputer:2321/siebel/SCCObjMgr_enu","enu");
// Create the example-accounts starting with "Ai":
AccountIC acctIC = new AccountIC();
Account_InterfaceIO acctIO = new Account_InterfaceIO();
acctIO.addfintObjInst(acctIC);
acctIC.setfName("Ai*");
QueryByExampleInput qbeIn = new QueryByExampleInput();
qbeIn.setfSiebelMessage(acctIO);
// Call QueryByExample
QueryByExampleOutput qbeOut = svc.mQueryByExample(qbeIn);
acctIO = new Account_InterfaceIO(qbeOut.getfSiebelMessage().toPropertySet());
Vector ioc = acctIO.getfintObjInst();
// print the name of each account returned:
if (!ioc.isEmpty()) {
for(int i=0; i < ioc.size(); i++) {
acctIC = (AccountIC) ioc.get(i);
System.out.println(acctIC.getfName());
}
}
}