Siebel EAI: Create a account with EJB3.x using AccountAttachment Business Service

本文介绍了如何在Siebel环境下使用Siebel Code Generator生成EJB代码,并部署到应用服务器,进而实现批量创建1000个账号的功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

This is a new feature in 8.1.1. And since my env is not a published release, may be you cannot achieve same thing in your env. However, may be you can approach this functional in 8.2 in future.

1. Go to Siebel Code Generator to generate EJB codes for BS:AccountAttachment. You can find this toolkit in Siebel Tools.

2. Deploy your EJB to application server

3. following is my codes of creating 1000 accounts.

package accountattachment;

import com.siebel.data.SiebelException;

import com.siebel.ejb.jca.accountattachment.AccountAttachmentSessionEJBRemote;
import com.siebel.integration.util.JCASessionProperties;

import java.util.Hashtable;
import java.util.ArrayList;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

import javax.rmi.PortableRemoteObject;

import com.siebel.local.account.Account_AttachmentIC;
import com.siebel.local.account.AccountIO;
import com.siebel.local.account.AccountIC;
import com.siebel.local.account.Document;
import com.siebel.service.jca.accountattachment.QueryByExampleInput;
import com.siebel.service.jca.accountattachment.QueryByExampleOutput; //.QueryPageOutput;

import com.siebel.service.jca.accountattachment.InsertInput;
import com.siebel.service.jca.accountattachment.InsertOutput;


import com.siebel.service.jca.accountattachment.InsertInput;
import com.siebel.service.jca.accountattachment.InsertOutput;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;

public class AccountAttachment_Insert1000Accounts 
{
    private static InitialContext jndi ;
    
    private static void init() throws Exception
    {
        Hashtable ht = new Hashtable();
        ht.put(Context.INITIAL_CONTEXT_FACTORY,
               "weblogic.jndi.WLInitialContextFactory");
        ht.put(Context.PROVIDER_URL, "t3://localhost:7101");
        ht.put(Context.SECURITY_PRINCIPAL, "weblogic");
        ht.put(Context.SECURITY_CREDENTIALS, "weblogic1");
        jndi = new InitialContext(ht);
    }
    
    private static AccountAttachmentSessionEJBRemote getEJBHome(String EJBName) throws NamingException {
        AccountAttachmentSessionEJBRemote m_cf_home =
            (AccountAttachmentSessionEJBRemote)PortableRemoteObject.narrow(jndi.lookup(EJBName),
                                                                           AccountAttachmentSessionEJBRemote.class);

        System.out.println("m_cf_home " + m_cf_home.toString());
        return m_cf_home ;
    }
    
    private static void createAccount(String accountName) throws NamingException {
        AccountAttachmentSessionEJBRemote m_cf_home = getEJBHome("yxyTest.AccountAttachmentSessionEJB") ;

        ArrayList<AccountIC> ioc = null;

        AccountIO objAccountIO = new AccountIO();
        InsertInput objInsertInput = new InsertInput();
        InsertOutput objInsertOutput = new InsertOutput();


        objInsertInput.setfLOVLanguageMode("LIC");
        objInsertInput.setfViewMode("All");
        
        
        JCASessionProperties objJCAEJBStructure= new JCASessionProperties();
        objJCAEJBStructure.setSessionUserName("SADMIN");
        objJCAEJBStructure.setSessionPassword("SADMIN");



        AccountIC objAccountIC = new AccountIC();

        objAccountIC.setfName(accountName);
        objAccountIC.setfLocation("Beijing");
        objAccountIC.setfPrimary_Organization("Default Organization");
        objAccountIC.setfAccount_Status("Active");
        
        AccountIC[] objAccountICArray = new AccountIC[1];
        objAccountICArray[0] = objAccountIC;
        
        objAccountIO.setfintObjInst(objAccountICArray[0]);
        objAccountIO.setfdocObjInst(null);

        objInsertInput.setfSiebelMessage(objAccountIO);
        objInsertOutput = m_cf_home.Insert(objInsertInput, objJCAEJBStructure);

    }
    
    public static void main(String[] ars) throws Exception {

        init() ;
    
        for(int i=1 ; i<=1000 ; i++)
        {
            createAccount("Account_"+i) ;
        }
        
        
    }

}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值