`
huobengle
  • 浏览: 857530 次
文章分类
社区版块
存档分类
最新评论

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

 
阅读更多

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) ;
        }
        
        
    }

}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics