Oracle® Application Server Adapter for J.D. Edwards OneWorld User's Guide
10g Release 2 (10.1.2) B14059-02 |
|
Previous |
Next |
This chapter describes Oracle Containers for J2EE (OC4J) deployment and integration with OracleAS Adapter for J.D. Edwards OneWorld.
This chapter discusses the following topics:
See Also: |
OracleAS Adapter for J.D. Edwards OneWorld is deployed within an OC4J container during installation. All client applications run within the OC4J environment. In J2CA deployment, the Common Client Interface (CCI) integrates an OC4J client application with a resource adapter.
See Also:
|
Figure 3-1 shows deployment of the Connector to the Oracle Application Server. In a runtime service scenario, an Enterprise Java Bean (EJB), Servlet, or Java program client makes CCI calls to J2CA resource adapters. The adapters process the calls as requests and send them to the EIS. The EIS response is then sent back to the client.
Figure 3-1 Oracle Application Server Adapter J2CA Architecture
During the J2CA deployment of OracleAS Adapter for J.D. Edwards OneWorld, OC4J generates a deployment descriptor called oc4j-ra.xml
, located in OC4J_home
\integration\orabpel\system\appserver\oc4j\j2ee\home\application-deployments\default\iwafjca
.
Note: Your installation directory contains more than one file namedoc4j-ra.xml . The OC4J deployment descriptor described in this section is located in the OC4J_home\integration\orabpel\ system\appserver\oc4j\j2ee\home\application-deployments\default\iwafjca directory.
|
Creating a Managed Connector Factory Object
The oc4j-ra.xml
descriptor provides OC4J-specific deployment information for resource adapters. For example, the default jca_sample
configuration in Application Explorer is represented in the oc4j-ra.xml
file as follows:
<?xml version="1.0"?> <!DOCTYPE oc4j-connector-factories PUBLIC "-//Oracle//DTD Oracle Connector 9.04//EN" "http://xmlns.oracle.com/ias/dtds/oc4j-connector-factories-9_04.dtd"> <oc4j-connector-factories> <connector-factory location="eis/OracleJCAAdapter/DefaultConnection" connector-name="IWAFJCA10"> <config-property name="IWayHome" value="../../adapters/application"/> <config-property name="IWayConfig" value="jca_sample"/> <config-property name="IWayRepoURL" value=""/> <config-property name="IWayRepoUser" value=""/> <config-property name="IWayRepoPassword" value=""/> <config-property name="logLevel" value="debug"/> </connector-factory> </oc4j-connector-factories>
The parameters defined in the oc4j-ra.xml
file are described in the following table:
Parameter Name | Description |
---|---|
IWayHome | The base installation directory for the OracleAS packaged application adapter. |
IWayConfig | The adapter configuration name as defined in Application Explorer. For example, OracleAS Adapter for J.D. Edwards OneWorld has a preconfigured jca_sample configuration in Application Explorer.
|
IWayRepoURL | The URL to use when opening a connection to the database. This is necessary only when using an Oracle database as the BSE repository. See "Configuring BSE System Settings" for more information. |
IWayRepoUser | User name to use when connecting to the database. This is necessary only when using an Oracle database as the BSE repository. See "Configuring BSE System Settings" for more information. |
IWayRepoPassword | Password. If provided, it overwrites configuration. This is necessary only when using an Oracle database as the BSE repository. See "Configuring BSE System Settings" for more information. |
loglevel | It overwrites the level set by the ManagedConnectionFactory property. |
Creating Multiple Managed Connector Factory Objects
To establish multiple managed connector factory objects, you must edit the oc4j-ra.xml
file and add more <connector-factory>
nodes. For example, the default jca_sample
configuration in Application Explorer is represented in the oc4j-ra.xml
file as follows:
<?xml version="1.0"?> <!DOCTYPE oc4j-connector-factories PUBLIC "-//Oracle//DTD Oracle Connector 9.04//EN" "http://xmlns.oracle.com/ias/dtds/oc4j-connector-factories-9_04.dtd"> <oc4j-connector-factories> <connector-factory location="eis/OracleJCAAdapter/DefaultConnection" connector-name="IWAFJCA10"> <config-property name="IWayHome" value="../../adapters/application"/> <config-property name="IWayConfig" value="jca_sample"/> <config-property name="IWayRepoURL" value=""/> <config-property name="IWayRepoUser" value=""/> <config-property name="IWayRepoPassword" value=""/> <config-property name="logLevel" value="debug"/> </connector-factory> </oc4j-connector-factories>
To create multiple managed connector factory objects, you must add new <connector-factory> nodes in the file. For example:
<?xml version="1.0"?> <!DOCTYPE oc4j-connector-factories PUBLIC "-//Oracle//DTD Oracle Connector 9.04//EN" "http://xmlns.oracle.com/ias/dtds/oc4j-connector-factories-9_04.dtd"> <oc4j-connector-factories> <connector-factory location="eis/OracleJCAAdapter/DefaultConnection1" connector-name="IWAFJCA10"> <config-property name="IWayHome" value="../../adapters/application"/> <config-property name="IWayConfig" value="jca_sample"/> <config-property name="IWayRepoURL" value=""/> <config-property name="IWayRepoUser" value=""/> <config-property name="IWayRepoPassword" value=""/> <config-property name="logLevel" value="debug"/> </connector-factory> <connector-factory location="eis/OracleJCAAdapter/DefaultConnection2" connector-name="IWAFJCA10"> <config-property name="IWayHome" value="../../adapters/application"/> <config-property name="IWayConfig" value="jca_sample2"/> <config-property name="IWayRepoURL" value=""/> <config-property name="IWayRepoUser" value=""/> <config-property name="IWayRepoPassword" value=""/> <config-property name="logLevel" value="debug"/> </connector-factory> </oc4j-connector-factories>
The following example shows the code structure for using CCI with packaged application adapters. The code sample is shown in four steps.
Step 1. Obtain the Connection Factory
The connection factory is obtained by JNDI lookup.
InitialContext context = new InitialContext(); ConnectionFactory cf = (ConnectionFactory)context.lookup(iwayJndi)
Step 2. Obtaining a Connection for the Adapter
IWAFConnectionSpec is an implementation of ConnectionSpec used for creating a design time or runtime service adapter connection. The ConnectionSpec has seven parameters. Connection Pooling is fully supported and established based on these parameters, except log level.
The iWAFConnectionSpec can initiate an interaction with J.D. Edwards OneWorld if the adapter name and configuration parameters are specified in the ConnectionSpec. For example,
iWAFConnectionSpec cs = new IWAFConnectionSpec(); cs.setAdapterName(ADAPTER); cs.setConfig(TARGET); cs.setLogLevel(LOG_LEVEL); // Adapter layer log level Connection c = cf.getConnection(cs);// where cf is the connection factory
In this snippet, ADAPTER
and TARGET
refer to the adapter being deployed, in this case J.D. Edwards OneWorld, and the name of a target defined in Application Explorer. See"Complete Code Sample" for more information.
Step 3. Create interaction with interactionSpec for runtime
Interaction i = c.createInteraction(); IWAFInteractionSpec is = new IWAFInteractionSpec(); is.setFunctionName(IWAFInteractionSpec.PROCESS);
Two functions can be set: PROCESS and IWAE. PROCESS is used at runtime. IWAE is used when you are using the IAEAdapter at design time.
Step 4. Create Input Record and Execute Interaction
In this case, to complete the EIS invocation, a schema is provided by Application Explorer.
A standard J2CA Indexed Record is used in this example:
// Use JCA IndexRecord, named "input" for runtime processing.
IndexedRecord rIn = cf.getRecordFactory().createIndexedRecord("input");
rIn.add(msg_run
);
IndexedRecord rOut = (IndexedRecord)i.execute(is, rIn);
System.out.println((String)rOut.get(0));
A special record is supported in this example:
//IWAFRecord rIn = new IWAFRecord("input");
//rIn.setRootXML(msg_run
);
//IWAFRecord response = executeRunInteraction(c, rIn);
//IWAFRecord rOut = (IWAFRecord)i.execute(is, rIn);
//System.out.println(rOut.getRootXML());
Where msg_run
is an instance XML document generated from the schema created by Application Explorer. For example, the following is a sample J.D. Edwards OneWorld request XML document.
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?> <jdeRequest type="callmethod" user="JDE" pwd="JDE" environment="DV7333" session="" sessionidle=""> <callMethod name="AddressBookMasterMBF" app="" runOnError="" trans=""> <params> <param name="cActionCode">A</param> <param name="cUpdateMasterFile">1</param> <param name="cProcessEdits">1</param> <param name="cSuppressErrorMessages"/> <param name="szErrorMessageID" /> <param name="szVersion">ZJDE0001</param> <param name="mnSameAsExcept" /> <param name="mnAddressBookNumber" id="1" /> <param name="szLongAddressNumber" /> <param name="szTaxId" /> <param name="szSearchType">C</param> <param name="szAlphaName">John J. Smith</param> <param name="szSecondaryAlphaName">John J. Smith</param> <param name="szMailingName">John J. Smith</param> <param name="szSecondaryMailingName">John J. Smith</param> <param name="szDescriptionCompressed" /> <param name="szBusinessUnit"/> <param name="szAddressLine1">1 Main St.</param> <param name="szAddressLine2">Apt 101</param> <param name="szAddressLine3"/> <param name="szAddressLine4"/> <param name="szPostalCode">75000</param> <param name="szCity">AnyTown</param> <param name="szCounty"/> <param name="szState">TX</param> <param name="szCountry">US</param> <param name="szCarrierRoute" /> <param name="szBulkMailingCenter" /> <param name="szPrefix1" /> <param name="szPhoneNumber1">917-123-4567</param> <param name="szPhoneNumberType1" /> <param name="szPhoneAreaCode2" /> <param name="szPhoneNumber2" /> <param name="szPhoneNumberType2" /> <param name="cPayablesYNM">Y</param> <param name="cReceivablesYN">N</param> <param name="cEmployeeYN">N</param> <param name="cUserCode" /> <param name="cARAPNettingY">N</param> <param name="cPersonCorporationCode" /> <param name="szCertificate" /> <param name="szAddlIndTaxID" /> <param name="szCreditMessage" /> <param name="szLanguage" /> <param name="szIndustryClassification" /> <param name="cEMail" /> <param name="szCategoryCode01" /> <param name="szRemark"/> <param name="szUserReservedCode"/> <param name="jdUserReservedDate"/> <param name="mnUserReservedAmount"/> <param name="mnUserReservedNumber"/> <param name="szUserReservedReference"/> <param name="jdDateEffective" /> <param name="szRemark1" /> </params> <onError abort=""/> </callMethod> </jdeRequest>
Complete Code Sample
The following is a sample of the complete code:
import javax.resource.cci.*; import com.ibi.afjca.cci.*; import com.ibi.afjca.spi.*; /** * The purpose of this sample is to illustrate how to use the IWAF Universal * JCA connector. */ public class IWAFJCASimple { private static String HOME = "c:/iway/xfoc/components/iwafcont/dist"; private static String CONFIG = "base"; private static String LOG_LEVEL = "FATAL"; private static String ADAPTER = "JDE"; private static String TARGET = "JDE_connection"; // Input Message private static String msg_run = "<JDE/>"; public static void main(String[] args) throws Exception { // 1. Getting the Connection factory through JNDI lookup // --------------------------------------------------------- InitialContext context = new InitialContext(); ConnectionFactory cf = (ConnectionFactory)context.lookup(iwayJndi) // 2. Getting a connection for a particular adapter target, in this case JDE // --------------------------------------------------------- IWAFConnectionSpec cs = new IWAFConnectionSpec(); cs.setAdapterName(ADAPTER); cs.setConfig(TARGET); cs.setLogLevel(LOG_LEVEL); // Adapter layer log level Connection c = cf.getConnection(cs);// where cf is the connection factory // 3. Create interaction with interactionSpec for RUNTIME // --------------------------------------------------------- Interaction i = c.createInteraction(); IWAFInteractionSpec is = new IWAFInteractionSpec(); is.setFunctionName("PROCESS"); // 4. Create input Record and execute interaction // --------------------------------------------------------- // 4.1 Using JCA standard Indexed Record // Use JCA IndexRecord, named "input" for runtime processing. IndexedRecord rIn = cf.getRecordFactory().createIndexedRecord("input"); rIn.add(msg_run
); IndexedRecord rOut = (IndexedRecord)i.execute(is, rIn); System.out.println((String)rOut.get(0)); // 4.2 Our own Record is supported here //IWAFRecord rIn = new IWAFRecord("input"); //rIn.setRootXML(msg_run
); //IWAFRecord response = executeRunInteraction(c, rIn); //IWAFRecord rOut = (IWAFRecord)i.execute(is, rIn); //System.out.println(rOut.getRootXML()); } // main() }