Transports and Interfaces: Siebel Enterprise Application Integration > Integrating Siebel Business Applications with Java Applications > About the Siebel Resource Adapter >

About the Connect String and Credentials for the Java Connector


The Java Connector Architecture allows for credentials to be supplied using either Container-Managed Sign-on or Application-Managed Sign-On.

With Container-Managed Sign-On, the application server's container identifies the principal and passes it to the JCA adapter in the form of a JAAS Subject. Application servers provide their own system of users and roles; such a user must be mapped to Siebel user and password for the purpose of the JCA adapter. Application servers allow the specification of such mappings. With Container-Managed Sign-On, the Siebel connect string and language must be specified in the deployment descriptor of the adapter (ra.xml). If a Siebel username and password are present in the descriptor, they will be used by the application server only to create an initial connection to the Siebel application when the application server is started, which is not necessary.

With Application-Managed Sign-On, the client application must provide the credentials and connect string. This is done just as for the Java Data Bean, as described in About Running the Java Data Bean, by either supplying them in siebel.properties or setting them programmatically using setUserName, setPassword, setConnectString, and setLanguage. If any of these parameters are supplied using Application-Managed Sign-On, then supply all four of them in that manner.

NOTE:  Connection parameters beginning with siebel.conmgr are read from siebel.properties, whether the adapter is being used in managed or nonmanaged mode.

Managed Code Sample Using the Siebel Resource Adapter

The following is a code sample using the Siebel Resource Adapter in a managed environment. The sample is a servlet that makes a simple invocation to a business service using the generated JCA code. (For more information on generating code, see About the Siebel Code Generator.)

The JCA ConnectionFactory is obtained through JNDI. Credentials are obtained at run time from the JAAS Subject passed to the servlet. The connect string and language are obtained from the deployment descriptor (ra.xml). Other connection parameters are obtained from the siebel.properties file.

NOTE:  The siebel.properties file must be in the JVM classpath and be specified explicitly when creating the business service instance.

import javax.naming.*;

import java.io.*;

import javax.servlet.*;

import javax.servlet.http.*;

import com.siebel.integration.jca.cci.SiebelConnectionFactory;

import com.siebel.service.jca.eaifiletransport.*;

public class ManagedConnectionServlet extends HttpServlet {

  public void doGet(HttpServletRequest request, HttpServletResponse response)   throws IOException,ServletException {

PrintWriter reply = response.getWriter();

try {

// Specify siebel.properties in the constructor.
EAI_File_TransportBusServAdapter bs = new EAI_File_TransportBusServAdapter("siebel.properties");

InitialContext jndi = new InitialContext();

SiebelConnectionFactory scf = (SiebelConnectionFactory)jndi.lookup("siebelJCA");

bs.setConnectionFactory(scf);

// Username and password obtained from JAAS Subject passed by server at runtime.

// Connect string and language obtained from deployment descriptor, ra.xml.

ReceiveInput input = new ReceiveInput();

input.setfCharSetConversion("UTF-8");

input.setfFileName("D:\\helloWorld.txt");

ReceiveOutput output = bs.mReceive(input);

reply.println(output.getf_Value_());

}

catch (Exception e) {

reply.println("Exception:" + e.getMessage());

}

}

  }

Nonmanaged Code Sample Using the Siebel Resource Adapter

The following is a code sample using the Siebel Resource Adapter in a nonmanaged environment. The sample performs the same function as the Managed sample; it is a servlet that makes a simple invocation to a business service using the generated JCA code. (For more information on generating code, see About the Siebel Code Generator.)

The JCA ConnectionFactory is created directly. The username, password, connect string, and language are obtained from siebel.properties or set programmatically. Other connection parameters are obtained from the siebel.properties file.

NOTE:  The siebel.properties file must be in the JVM classpath and be specified explicitly when creating the business service instance.

import java.io.*;

import javax.servlet.*;

import javax.servlet.http.*;

import com.siebel.integration.jca.cci.notx.SiebelNoTxConnectionFactory;

import com.siebel.service.jca.eaifiletransport.*;

public class BookshelfNonManagedConnectionSample extends HttpServlet {

  public void doGet(HttpServletRequest request, HttpServletResponse response)   throws IOException, ServletException {

PrintWriter reply = response.getWriter();

try {

EAI_File_TransportBusServAdapter bs = new EAI_File_TransportBusServAdapter("siebel.properties");

bs.setConnectionFactory(new SiebelNoTxConnectionFactory());

// Username, password, connect string, and language are read from
// siebel.properties, which must be in the classpath of the servlet
// and be specified in the constructor.

// Alternatively, they can be set here programmatically:

// bs.setUserName("USER");

// bs.setPassword("PWD");

// bs.setConnectString("siebel://examplecomputer:2321/siebel/SCCObjMgr_enu");

ReceiveInput input = new ReceiveInput();

input.setfCharSetConversion("UTF-8");

input.setfFileName("D:\\helloWorld.txt");

ReceiveOutput output = bs.mReceive(input);

reply.println(output.getf_Value_());

}

catch (Exception e) {

reply.println("Exception:" + e.getMessage());

}

}

}

Transports and Interfaces: Siebel Enterprise Application Integration Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Legal Notices.