This chapter contains the following topics:
The JD Edwards EnterpriseOne COM server contains two parts:
COM connector.
Generated JD Edwards EnterpriseOne COM (GenCOM) components (wrappers).
This diagram shows the two parts of the COM server:
The COM server provides an interface to JD Edwards EnterpriseOne, executes business functions within valid transactions, and provides error processing for interoperability clients. The main component of the COM server is the COM connector. The COM connector provides COM components that interface with JD Edwards EnterpriseOne and hosts the business component DLL generated by the GenCOM tool. The COM connector also provides the connector component that enables an interoperability client to log in and log out from JD Edwards EnterpriseOne. It manages all user sessions connected to the COM server. This table identifies the binaries that combine to comprise the COM connector:
Binary | Explanation |
---|---|
JDECOMConnector2.exe | Primary interface for login and createBusinessObjects. Also maintains the created users and business objects. |
JDECOMMN.dll | Interface for JDEMathNumeric and JDETimeZone. |
Callobject.dll | Internal to JDECOMConnector.exe. |
Comlog.dll | Used for logging, cache, and OCM lookup. |
EventClass.dll | JD Edwards EnterpriseOne event class that is implemented to receive events. |
EventListener.dll | Receives events from the JD Edwards EnterpriseOne server and publishes the events to COM+ Events. |
EventManager.dll | Provides the interface for subscribe, unsubscribe, getList, and getTemplate for events. |
jdeunicode.dll | The Unicode library, which is internal to JD Edwards EnterpriseOne. |
OneWorldInterfaceTx.dll | Provides the interface for JD Edwards EnterpriseOne transactions and COM+ two-phase commit transactions. |
Xmlinterop.dll | Contains the JDENET transport mechanism and the XMLRequest. |
ClientService.dll | Enables event notification and introspection using XML over HTTP protocol. Applicable for JD Edwards EnterpriseOne 8.95 and later Tools releases only. |
EventHandler.dll | Receives events from the Transaction server and publishes events to COM+. |
The JDECOMConnector2.idl defines the COM interfaces of the COM connector. JDECOMConnector2.idl is available under the Include directory.
The COM connector is available with the JD Edwards EnterpriseOne server and client install.
GenCOM is a client tool that uses a multipass process to generate JD Edwards EnterpriseOne COM components. GenCOM is included in the client installation. The COM Generation Tool is in <install>\system\bin32\GenCOM.exe.
GenCOM is a command line tool that reads a script file to determine which components to generate. GenCOM uses an iJDEScript file as input to generate a COM DLL that is hosted by the COM connector. The iJDEScript file specifies wrapper components for business functions. Once the generated wrapper components are registered to the COM environment, they can be used to access business function functionality.
This illustration shows the process:
GenCOM reads the iJDEScript file.
GenCOM retrieves the metadata for the business functions specified in the iJDEScript file.
GenCOM resolves dependency on the data structure.
GenCOM creates an internal emitter tree for the library to be generated.
GenCOM reads each node of the internal emitter tree and generates the appropriate COM code.
GenCOM generates a make file.
GenCOM compiles and builds the COM DLL from the generated code.
Because the GenCOM application produces interfaces based on the package currently installed on the machine, installation plans must be made on a site-by-site basis. The DLLs produced are business function release-dependent and can be installed only on machines with the identical packages available.
The GenCOM output is COM servers in the form of DLLs. You can use these DLLs to create an interface with the JD Edwards EnterpriseOne system. You should not assume that a client has installed these servers as part of the standard JD Edwards EnterpriseOne installation. You should provide a full installation of any of the servers the applications require.
Each time GenCOM generates a wrapper, it creates a ProgID for each COM component. The ProgID identifies the COM component in the registry. The ProgID is independent of JD Edwards EnterpriseOne and is based on the library and the interface specifications in the script file. The key, OneWorldRelease, contains the JD Edwards EnterpriseOne release and environment information. For example, if the library name is AddressBook and the interface name is JDEAddressBook, then the ProgID will be AddressBook.JDE AddressBook. If GenCOM is run with environment DV9NIS2, then the OneWorldRelease key contains DV9NIS2. If a type mismatch exists, you receive a warning.
The CompatibleEnvironment key remembers the list of JD Edwards EnterpriseOne environments with which the wrapper is compatible. If an environment is not on the list or is listed as incompatible, the COM client receives an error message when trying to create the object with the environment.
This sample code illustrates the standard ProgID naming conventions:
HKEY CLASSES ROOT\ CLSID\{77454442-7941-44BB-9BCB-4253E80AC8B3)} \InprocServer32 C:\B9\System\IDA\Samples\AddressBook\AddressBook.dll \ProgID AddressBook.JDEAddressBook \VersionIndependentProgID AddressBook.JDEAddressBook \OneWorldRelease DV9NIS2 \CompatibleEnvironment DV9NIS2
You set up an environment for GenCom on a Microsoft Windows client using Microsoft Visual Studio 2010. Setting up the GenCOM environment involves several steps. You should make sure that these items are set up appropriately:
Include directories
Lib Directories
Paths
Basemake directory
BKoffice directory
DXSDKROOT directory
INETSDK directory
<Directory where Microsoft Visual Studio 2010 files are located>\include
Example: C:\Program Files\Microsoft Visual Studio 10.0\VC\PlatformSDK\Include
Example: C:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\include
Example: C:\Program Files\Microsoft Visual Studio 10.0\VC\include
<Directory where JD Edwards EnterpriseOne is located and release either Master, Prod, or Pristine>\include
Example: C:\B9\System\include
Example: C:\B9\System\includev
Example: C:\B9\STAGINGA\include
< Directory where Microsoft Visual Studio 2010 files are located>\lib
Example: C:\Program Files\Microsoft Visual Studio 10.0\SDK\v2.0\Lib
Example: C:\Program Files\Microsoft Visual Studio 10.0\VC\lib
Example: C:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\lib
< Directory where JD Edwards EnterpriseOne is located>\System\Lib32
Example: C:\B9\system\Lib32
< Directory where Microsoft Visual Studio 2010 files are located>
Example: C:\Program Files\Microsoft Visual Studio 10.0\SDK\v2.0\Bin
Example: C:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools
Example: C:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\Bin
Example: C:\Program Files\Microsoft Visual Studio 10.0\VC\bin
Example: C:\Program Files\Microsoft Visual Studio 10.0\VC\PlatformSDK\
< Directory where Windows NT is located>
Example: C:\Winnt\System32
Example: C:\Program Files\Microsoft Visual Studio 10.0\VC\PlatformSDK\Include\BK Office.Mak
Example: C:\Program Files\Microsoft Visual Studio 10.0\VC\PlatformSDK
Example: C:\Program Files\Microsoft Visual Studio 10.0\VC\PlatformSDK
Example: C:\Program Files\Microsoft Visual Studio 10.0\VC\PlatformSDK
You run GenCOM from the command line to expose objects through COM. In a development environment, developers may run the COM Generation tool. In a production environment, a system administrator should run the COM Generation Tool.
To run GenCOM in Visual Studio 2010, include this setting in the JD Edwards EnterpriseOne Client jde.ini File, [JDE_CG] section:
VisualStudioVersion=10
When you use GenCOM, use the iJDEScript scripting language to script code generation activities. The syntax is:
GenCOM [options] [libraries]
For example, if you want to see available libraries that you can run GenCOM against, you enter the command C:\B9\System\Bin32>gencom /ListLibraries
from the system command line.
To generate COM wrappers for Category 1 business functions in the CAEC library, enter this command from the command line:
GenCOM /Cat 1 /UserID Devuser1 /Password Devuser1 /Environment ADEVHP02 CAEC
Options available for generation include:
Option | Description |
---|---|
/? | Lists the options available for generation. |
/C++ <option> | Provides GenCOM with the compiler options you want to use in the generation of the COM servers. |
/Cat <category> | Tells GenCOM to generate wrappers based on these categories:
master business functions major business functions minor business functions uncategorized business functions |
/CL <file> | Tells GenCOM what compiler (.exe) to use for compilation. |
/Cmd * | Processes code generation commands from the console. |
/Cmd <filename> | Processes code generation commands from <filename>. |
/Debug | Builds debug information (.pdb and .bsc files) into the libraries so that the Visual Studio debugger can access source information. |
/EnvironmentID <env> | Provides GenCOM with the environment in which you want to sign in to JD Edwards EnterpriseOne. |
/ErrFile <file> | Provides GenCOM with the filename to log errors produced by GenCOM during the generation process, for example, errors.log. |
/MIDL | Provides GenCOM with the MIDL compiler options you wish to use in the generation of the COM servers. |
/MTL <file> | Tells which MIDL compiler (.exe) to use for compilation. |
/ListLibraries | Lists all the available libraries against which you can run GenCOM. |
/MsgFile <file> | Provides GenCOM with the filename to log messages produced by GenCOM during the generation process, for example, messages.log. |
/NoBSFN | Tells GenCOM not to create wrappers for business functions. This option is for generating parameter sets only. |
/NoCompile | Tells GenCOM to generate the source files without compiling. |
/NoDebug | Optimizes libraries for space using the /O1 Visual C++ compiler option. |
/Out <path> | Provides GenCOM with the directory path in which to place the output files, for example C:\winnt\system32. |
/OWRelease flag for GenCOM | You can override the OWRelease information by activating this flag and typing a string that specifies the version information. The recommendation is that you follow a naming convention that is consistent throughout the implementation or use the default version information that is generated by GenCOM. |
/Password <password> | Provides GenCOM with the password with which you want to sign in to JD Edwards EnterpriseOne. |
/Role | Provides GenCOM with the role with which you want to sign in to JD Edwards EnterpriseOne. |
/STA | Generates STA components. (By default, all generated components are MTA and are optimized for scalability and performance. /STA enables you to generate STA components if you need them.) |
/TempOut <path> | Provides GenCOM with the directory path in which to place temporary files needed for the build process, for example, C:\temp. |
/UserID <userid> | Provides GenCOM with the user name with which you wish to sign in to JD Edwards EnterpriseOne. |
The output for GenCOM produces fully functional COM servers based on the library to which you generate wrappers. Because you are interacting with the JD Edwards EnterpriseOne system, you must follow security and installation procedures to gain access to the system.
You must have a fully licensed copy of JD Edwards EnterpriseOne properly installed on the target machine. You must also sign in to the JD Edwards EnterpriseOne environment. For the sign-in process, you use the jdeCOMConnector interface.
This code example demonstrates how to use a generated COM business function wrapper in Visual Basic. This example creates business objects. Refer to the AddressBook sample included with the COM interoperability software for a complete working example of this functionality.
Dim WithEvents OW As OneWorldInterface '//OneWorldInterface Dim conn As New Connector '//COM Connector Dim connRole As IConnector2 '//Connector Interface with role Dim AB as JDEAddressBook '//AddressBook Dim phone as D0100032 '//Data Source Dim Mailing As D0100031 '//Data Source Dim AddressAs D0100033 '//Data Source Dim EffectiveDate As D0100019 '//Data Source DimParentAddress As D0100381 '//Data Source Dim sessionID As Long '//server Session ID Private Sub Form_Load() Set connRole = conn 'sessionID=conn.Login("Foo", "Bar", "DV9NIS2", "*ALL") sessionID=connRole.Login("Foo", "Bar", "DV9NIS2", "*ALL") Set OW = conn.CreateBusinessObject("OneWorld.FunctionHelper.1", sessionID) Set AB = conn.CreateBusinessObject("AddressBook.JDEAddressBook", sessionID) Set phone = AB.CreateGetPhoneParameterset Set Mailing = AB.CreateGetMailingNameParameterset SetAddress = AB.CreateGetEffectiveAddressParameterset Set EffectiveDate = AB.CreateGetABEffectiveDateParameterset Set ParentAddress = AB.CreateGetParentAddressParameterset End Sub
This Visual C++ code example demonstrates how to create the connector and how to create a business function on the COM server. This example creates an AddressBook business function and uses GenCOM objects from C++.
#include <windows.h> #include <stdio.h> #include <objbase.h> #include <comdef.h> #include <wchar.h> #include addressbook.h #include AddressBook_i.c #include jdecomconnector2.h #include jdecomconnector2_i.c #define IPhone ID0100032 #define IMailing ID0100031 #define IAddress ID0100033 #define IEffectiveDate ID0100019 #define IParentAddress ID0100381 #define SERVER OLESTR("COMSRV") //Change to the COM server. #define ABNO 4242 //change this according to user input. HRESULT CreateConnector( IConnector **ppConnector ) { HRESULT hr = E_FAIL; *ppConnector = 0; //NOTE: Pass a COSERVERINFO struct to activate on a remote machine COSERVERINFO csi = {0, SERVER, 0, 0}; MULTI_QI mqi = { &IID_IConnector, 0, 0 }; hr = CoCreateInstanceEx(CLSID_Connector, 0, CLSCTX_LOCAL_SERVER, 0, // &csi, 1, &mqi); if(SUCCEEDED(hr) && SUCCEEDED(mqi.hr)) { ppConnector = reinterpret_cast<IConnector*>(mqi.pItf); } return hr; } HRESULT Login( IConnector **pConnector, IOneWorldInterface **ow, long *accessno ) { HRESULT hr; IDispatch *idsptch = 0; printf("Login started\n"); bstr_t User(L "Foo "), PassWord(L"Bar "), Env("DV9NIS2"); hr = (*pConnector)->Login(User,PassWord,Env,accessno ); if( !SUCCEEDED(hr)) { printf( "Login failed with hr = %x",hr); return E_FAIL; } _bstr_t bo("OneWorld_FunctionHelper.1"); hr=(*pConnector)->CreateBusinessObject(bo, *accessno, &idsptch ); if( !SUCCEEDED(hr)||(!ow)) { Printf("CreateBusinessObject(OneWorld.FunctionHelper.1) failed with hr %x",hr); return E_FAIL; } hr=idsptch->QueryInterface(IID_IOneWorldInterface, (void **)ow ); if(!SUCCEEDED(hr)||(!ow)) { Printf( QueryInterface for IOneWorldInterface failed with hr "%x",hr); return E_FAIL } printf("Login completed \n"); return S_OK; } HRESULT UseAddressBook(IConnector *pConnector, IOneWorldInterface *ow, long*accessno) { HRESULT hr; IJDEAddressBook *ab; IDispatch *idsptch; IPhone *phone; IMailing *Mailing; IAddress *Address; IEffectiveDate *EffectiveDate; IParentAddress ParentAddress; printf("Starting to use AddressBook\n"); _bstr_t bo("AddressBook.JDEAddressBook"); hr = pConnector->CreateBusinessObject(bo, *accessno, &idsptch); hr = idsptch->QueryInterface( IID_IJDEAddressBook, (void **&ab); if(!SUCCEEDED(hr)||(tab)) { printf( "CreateBusinessObject( AddressBook ) has failed with hr %x", hr); return E_FAIL; } return S_OK; }
This code creates the connector object and uses it to create a business function with its associated ParameterSet. The code then calls a method, Foo1, on the business object with the ParameterSet, the connector, and the access code returned by the act of logging on to the connector.
Int main(int argc, char *argv[]) { HRESULT hr; IOneWorldInterface *ow; long accessno; IConnector *pConnector; hr - CoInitializeEx(0, COINIT_MULTITHREADED); if(SUCCEEDED(hr)) ( hr = CreateConnector(&pConnector); if(SUCCEEDED(hr)) { Login( &pConnector, &ow, &accessno ); //Do more processing with AddressBook and logoff at the end. } CoUninitialize(); }
You can run CheckVer to verify whether a previously generated COM object is compatible with another environment. Typically, a system administrator performs this task.
The XML files generated by GenCOM are the signatures of the objects generated against specific JD Edwards EnterpriseOne environments. These XML files can be used with CheckVer to verify that the wrappers on the COM server are compatible with these environments.
When you introduce a new JD Edwards EnterpriseOne environment, you run GenCOM against the new environment by using the /NoCompile option. You also use the iJDEScript that you used to generate the wrappers on the COM server to generate XML signature files for the objects in the new environment. Run CheckVer on the COM server with the newly generated XML files to verify that the new environment is compatible with wrappers on the COM server that was previously generated with a different environment. CheckVer updates the registry settings for the wrapper on the COM server according to the result of the compatibility test. If the new environment is incompatible, the COM client cannot create business objects with the new environment.
CheckVer compares the XML signature file that is produced from GenCOM with the spec definitions on the local JD Edwards EnterpriseOne client machine. You can run CheckVer from the command line on the COM server, or CheckVer can be run automatically as part of the GenCOM process.
To see the options that CheckVer provides, run this command from the command line:
c:\>CheckVer.exe -?
CheckVer [option] <filename>
CheckVer -r addressbook.xml
-r -- CheckVer reports only whether the environment is compatible with the server. It does not update the registry settings for the wrapper on the COM server with the result, and CheckVer does not validate the wrapper DLL.