Bookshelf Home | Contents | Index | PDF | ![]() ![]() |
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 ConnectorThe 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 AdapterThe 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 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(); // Specify siebel.properties in the constructor. InitialContext jndi = new InitialContext(); SiebelConnectionFactory scf = (SiebelConnectionFactory)jndi.lookup("siebelJCA"); // 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_()); reply.println("Exception:" + e.getMessage()); Nonmanaged Code Sample Using the Siebel Resource AdapterThe 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 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(); EAI_File_TransportBusServAdapter bs = new EAI_File_TransportBusServAdapter("siebel.properties"); bs.setConnectionFactory(new SiebelNoTxConnectionFactory()); // Username, password, connect string, and language are read from // Alternatively, they can be set here programmatically: // bs.setConnectString("siebel://mymachine: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_()); |
![]() |
![]() ![]() |
Transports and Interfaces: Siebel Enterprise Application Integration | Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Legal Notices. | |