Siebel JAVA DATA BEAN

Friends when I was working on Siebel Android App, I had a very bigger question: How to make connection with Siebel to get Siebel data and display it on mobile app ?
At that time I had struggle of 2-3 days then finally I came to know that there are two ways of making connection with Siebel and get Siebel data access.

1.)  Access Siebel Web Services through ksoap2 connections
2.)  Make a direct entry in Siebel through  Siebel JAVA DATA BEAN

In this post, I will explain second method. Its pros and cons, what problems I had faced and full explanation of how to implement this. Well I am a Siebel guy, so you find a working java code only.

Lets start...


Siebel JAVA DATA BEAN


Pros: We can have direct Siebel data access. We can write our code as if we writing any business script.

Cons: Its making separate connection for each request, so it can be show stopper if we haven't managed connection pooling or something.

How to implement:

A Java client that uses the Siebel Java Data Bean to connect to the Siebel Server requires JAR files. These files allow the Java language to access the objects and methods of the Siebel Object Interface. 
To access the Siebel Java Data Bean

  1. Add the following JAR files to the CLASSPATH:
    • Siebel.jar
    • SiebelJI_lang.jar
  2. To install the Siebel Java Data Bean interface, do one of the following:
    • Just make sure that you have working Siebel Enterprise Server where EAI connections are configured.
  3. Start a new SiebelDataBean Java object.    
  4.  dataBean = new SiebelDataBean();
  5. To call the Login method for the object you started in Step 3, use the following code:
    connectString = String.format("Siebel://"+gateway_server+":"+gateway_port+"/"+entrpr_name+"/SSEObjMgr_enu");
  6. dataBean.login(connectString, username, password, "enu");
  7. sample connectString = siebel.TCPIP.None.None://13.129.57.30:2014/eagleprodunt/EAIObjMgr_enu

Example of Accessing the Siebel Java Data Bean


The following example code accesses the Siebel Java Data Bean. You can use a Java IDE to compile and run this code:

import com.siebel.data.*;
import com.siebel.data.SiebelException;
public class DataBeanDemo
{
   private SiebelDataBean m_dataBean = null;
   private SiebelBusObject   m_busObject = null;
   private SiebelBusComp       m_busComp = null;
   public static void main(String[] args)
   {
      DataBeanDemo demo = new DataBeanDemo();
   }
   public DataBeanDemo()
   {
      try
      {
         // instantiate the Siebel Java Data Bean
         m_dataBean = new SiebelDataBean();
         // log in to the Siebel Server
         // SiebelServerhost = the name or IP address of your Siebel Server
         // SCBPort = listening port number for the SCBroker component (default 2321)
         m_dataBean.login("Siebel://SiebelServerhost:SCBPort/enterpriseServer/
          AppObjMgr_enu", Username, Passw, "enu");

   // get the business object
     SiebelBusObject busObject = dataBean.getBusObject("Contact");
   // get the business component
  SiebelBusComp busComp = busObject.getBusComp("Contact");

  SiebelService bsOCMgr = dataBean.getService("Outbound Communications Manager");
  SiebelPropertySet psInp = new SiebelPropertySet();
  SiebelPropertySet psOut = new SiebelPropertySet();

  busComp.setViewMode(3);

  busComp.clearToQuery();
  busComp.activateField("Id");
  busComp.activateField("First Name");
  busComp.activateField("Last Name");
  busComp.activateField("Email Address");
  
  busComp.setSearchSpec("Login Name", "SADMIN");
  busComp.setSearchSpec("First Name", "CHRISTINA");
  
  busComp.executeQuery2(true,true);
  
  if (busComp.firstRecord()) {
   
   String Email = busComp.getFieldValue("Email Address");
   System.out.println("Email Address"+ Email);
   }
    bsOCMgr.release();
  busComp.release();

  busObject.release();


         // log off
         m_dataBean.logoff();
      }
      catch (SiebelException e)
      {
         System.out.println(e.getErrorMessage());
      }
   }
}

We can find more detailed version of this on below links:

Hope this will help someone in need. Thanks for reading this. Please feel free to have your comments below.
@SimplySiebel

.

Labels: ,