Integration

SAP J2EE Engine 6.20

................................................................................................................... 18 Monitoring System . 11 Why a Repository? ................................................................................................................................................................................................ 11 Architecture...........................................................................................................................................................................................................4 Internet Communication Manager (ICM) ............ 6 Request Handling and Dispatching ............................... 16 Command Interface ................................................... 14 Usage of Native Libraries for SAP Web AS – SAP J2EE Engine Integration ................................................................................................. 18 Application Tracing ...................... 8 Scenario............20 Contents Introduction ...............................................................SAP J2EE Engine Communication ............................................................................................................................................................. 17 Logging and Monitoring ............ 13 R3Startup Manager ........................................................................ 10 Call Java Functions from SAP R/3 ...................................... 18 Logging ................3 SAP Web Application Server Architecture .............................................................................................................................. 16 SAP Web AS ............................................... 7 ABAP <-> Java Communication ............................. 9 RFC Library ...................................................... 11 Configuration and Testing......................................................................................................................................... 18 2/19 ...................................... 5 Clustering..............Integration SAP J2EE Engine 6................................................................................................................................ 15 R3Startup Service.........................................................................8 SAP Java Connector (JCo).... 8 Remote Function Call (RFC) ......................................

as well as with the position that SAP J2EE Engine has inside SAP Web AS.com -> SAP Library -> mySAP Technology Components -> SAP Web Application Server -> SAP J2EE Engine -> Integration of the Security Functions of SAP Web Application Server and SAP J2EE Engine. monitoring. For reasons of consistency the document covers at first the aspects connected with the architecture.20 Introduction This document aims to describe how the integration between SAP J2EE Engine and SAP Web Application Server (SAP Web AS) is designed. Some of the most important are: • • • • ABAP <-> Java communication R3Startup Manager R3Startup Service Logging.Integration SAP J2EE Engine 6.sap. and application tracing. There are several areas that take part in this integration. see http://help. 3/19 . Note: For information on logging in SAP R/3 system.

Common installation. Coexistance of ABAP and Java engine. The Server Cache in Internet Communication Manager (ICM) can be used by both engines. Central HTTP logfile or capture log of all requests/responses. see SAP Web AS documentation. Note: For more information about the SAP Web Application Server Architecture.Integration SAP J2EE Engine 6. Common certificate administration (the HTTPS connection is terminated in the ICM). Common Java and ABAP administration and monitoring. 4/19 .20 SAP Web Application Server Architecture SAP Web Application Server Architecture In this collaborative architecture the user benefits from several aspects: • • • • • • • One central access point for HTTP(S) requests.

For example: the IP address of the client.e.Integration SAP J2EE Engine 6. additional information from the HTTP request parsing is logged. If the connection Client – ICM is through SSL. which the ICM responds to. The ICM sets the trace level of the HTTP Server. One socket is used from lots of clients. 5/19 . The trace level shows how to log the information during parsing the ICM protocol of the dispatcher (logging errors and debugging depends on the level). ICM takes care for the manipulation of the persistent and non-persistent connection to the client. This "trailer" is used also to send information to the Web Server about the socket. the ICM verifies the socket on SSL level and opens new clean HTTP socket to the Web Server. The information can be viewed in the files of the Log service. The Web Server uses it to forward the response. ICM opens clients’ sockets directly to the Web Server and redirects to it the client request. it is not influenced by the KeepAliveTimeout property of the Dispatcher and so on. The IP taken from the client’s socket of the server (in this case of the ICM) is not used. The socket “ICM – J2EE” can be closed only by the ICM.20 Internet Communication Manager (ICM) The ICM ensures the communication between the SAP Web Application Server and the SAP J2EE Engine using the HTTP and HTTPS protocols. The client cannot access directly the Web Servers. ICM ensures the client connection with SAP Web servers (ABAP and JAVA). Also the methods of the Servlet API for getting the client IP use it. Instead the IP taken from the protocol is used. It also sends the server response back to the client. i. the protocol type (i. The Web Server can use the certificate for login or to grant it to the application through the Servlet API. HTTP or HTTPS). i. not the ones taken from the socket. there is not a new client socket for each server client. because lots of client requests pass through one socket. ICM redirects the HTTP request from the client to the server unchanged. It has only access to the HTTP socket opened by the ICM. It only adds few "trailer" bytes before each piece to obtain correct manipulation of the connections. which the Web Server cannot access. the required certificate if the socket “client – ICM” is SSL. If the trace level is set.e. This socket is used to send HTTP request without using SSL.e. It also sends the certificate that has been read from the socket as a byte array. In the ICM – J2EE protocol the trace level is shown. The HTTP Dispatcher takes care that these values are sent to the application. It processes requests from the Internet that have URLs with the server/port combination.

6/19 . By default the files cached in both places coincide. on which the Central Instance (CI) is running. HTTP Cache. backup state controller. This mechanism is done by using the Web AS – J2EE communication.20 The static HTTP requests are cached in two levels – J2EE cache and ICM cache. by using the clearhttpcache command of the HTTP Server or by using the ICM administration tools. use the HTTP Server property –SapCacheControl. this also triggers the clearing of the ICM cache. The SAP J2EE Engine on a Dialog Instance (DI) only starts. The default value of this property is 86400. Note: For more information about ICM. and application nodes belonging to one SAP system form a cluster. see the SAP Web Application Server documentation: • • • SAP Library->mySAP Technogy Components->SAP Web Application Server>SAP J2EE Engine->Integrating the SAP J2EE Application Server>Administration of the SAP Web Application Server SAP Library->mySAP Technogy Components->SAP Web Application Server>Client/Server Technology->Architecture of the SAP Web Application Server SAP Library->mySAP Technogy Components->SAP Web Application Server>Client/Server Technology->Architecture of the SAP Web Application Server>Parameterizing the ICM and the ICM Server Cache->Sample Profile for the ICM Clustering The SAP J2EE Engine’s state controller. The J2EE Engine decides how much time (if any at all) the files will be stored using the HTTP header "sap-cache-control". Note: The SAP J2EE Engine can only be started by starting the Web Application Server. The host. To set this value. which are from the J2EE Engine has alias "J2EE/" + <web_application_name>. The J2EE Engine cache can be cleared at deploy. or remove phases of an application. but this still depends on the settings of the J2EE Engine and ICM. By default the ICM cache keeps the files of J2EE for 24 hours. This alias is used for listing or deleting of cached files from the ICM administration tools. When the J2EE Engine cache is cleared. if the CI and the SAP J2EE Engine on the CI is running.Integration SAP J2EE Engine 6. redeploy. update. All the files cached in the ICM. whose value sets the time (in seconds) for which the files will be cached in the ICM. serves as cluster host. and how to enable redirect from ICM to SAP J2EE Engine. dispatcher.

for example HTTP(S) requests that must be processed by the Internet Communication Framework (ICF). see SAP Library- 7/19 . However. • • >mySAP Technogy Components->SAP Web Application Server->SAP J2EE Engine>Integrating the SAP J2EE Application Server Note: For more information about request handling and dispatching. which you can create yourself.Integration SAP J2EE Engine 6. If you are using the system as a server. you need a HTTP Request Handler. HTTP request handlers are also shipped with the SAP System. can only process J2EE requests. The Internet Communication Framework (ICF) serves as the bridge between the C kernel in the SAP System and the application program (in ABAP). Defining the HTTP request handler yourself allows you to use the ICF flexibly in your application.20 Request Handling and Dispatching You can configure the SAP Web AS so that it: • can only process ABAP requests. The ICF provides the environment for handling HTTP requests in work processes on an SAP System (server and client). can process both ABAP and J2EE requests (that is. HTTP(S) requests that must be processed by the SAP J2EE Engine).

The SAP Java Connector is the best choice for building SAP-enabled Java applications because of the following features: • • • • • • • • High-performance JNI-based Remote Function Call (RFC) middleware Supports SAP R/3 system 3.0 version. The package supports both Java to ABAP System as well as SAP System to Java calls. It combines an easy to use API with unprecedented flexibility and performance. JCo is essential for the communication between SAP J2EE Engine and SAP Web Application Server. RFCs enable you to call and execute predefined functions in a remote system – or in the same system. In SAP J2EE Engine 6. A function is provided for receiving calls from the SAP systems.Integration SAP J2EE Engine 6.20 you need the 2. Supports synchronous. Remote Function Call (RFC) RFC is an SAP interface protocol. Note: You can download JCo at http://service.20 RFC is used for processing ABAP to Java requests.1H and higher (and other mySAP components that have Business Application Provider Interfaces (BAPIs) or RFMs). 8/19 . which simplifies the programming of communication processes between systems. It is acting as Java-Wrapper for the RFC-Library. This is done by registering SAP J2EE Engine as an RFC destination.sap. Follow the installation instructions to enable the SAP J2EE Engine to connect to SAP systems. For SAP J2EE Engine 6. Supports inbound (Java client calls BAPI or RFM) and outbound (ABAP calls Java server) calls.com/connectors. Multi-platform Complete and correct code-page handling (incl. multi-byte languages) Easy to install and deploy. Supports client pooling (good for web servers). transactional and queued RFC.20 ABAP <-> Java Communication SAP Java Connector (JCo) The SAP Java Connector is a toolkit that allows a Java application to communicate with any SAP system. RFCs manage the communication process. parameter transfer and error handling.

which is registered in the JNDI. 9/19 . the JCO needs a repository. the service is based on the JCO (SAP Java Connector). Technically.Function function) method.Function contains both the input and output parameters. It is possible to register it under different names and at different Gateways. Scenario 1. 2. On startup the RFC Engine service connects to the repository of an SAP system. The JCO. 4. Note: Make sure that the function is defined in the repository. The bean must implement the public void processFunction(JCO. The RFC Engine service registers itself at the Gateway with a defined name. The Gateway forwards the call to the RFC Engine. To parse correctly the function calls from the SAP system. This is a remote connection to a repository of an SAP system. An SAP system calls a function for the registered RFC destination. By the naming convention the JNDI name used is identical to the name of the SAP function module. 3.Integration SAP J2EE Engine 6. It dispatches the calls to a stateless session bean.20 The J2EE Engine RFC Engine Service processes calls from the SAP systems.

Most SAP R/3 connectors use the RFC library as communication platform to SAP systems. which is registered under the function name. dev_rfc. that is almost all features of RFC in SAP R/3 systems have to be supported by the RFC Library.Function) are passed to the Gateway. Maximum performance. The RFC Engine looks in the JNDI for the EJB.sl.trc: One file per call with detailed trace-info.dll Unix/Linux – librfccm. too. Maximum functionality.so. librfccm.trc: Combined file for all errors. Full compatibility to other RFC releases. 10/19 . The most important design features of the RFC Library are: • • • • • Working with the native RFC protocol.20 5.Function) method of the EJB found. and so on. which is accessible from any SAP R/3 system or an external application.Integration SAP J2EE Engine 6. RFC Library The RFC Library offers an interface to an SAP system. This interface provides the opportunity to call any RFC function in an SAP system from an external application. The RFC Engine calls the processFunction(JCO. The RFC library is available for all OS platforms: • • Windows – librfc32. On errors it writes trace-files into the current working-directory: • • rfc<GUID>. The RFC library is the most commonly used and installed component of existing SAP software. Maximum flexibility. 8. 6. The results of that call (the modified JCO. 7. Moreover. the RFC Library offers the possibility to write an RFC server program. The Gateway passes the results back to the SAP system.

Therefore the receiver needs a Repository to parse those values.Integration SAP J2EE Engine 6. but does not send the function definition. typically an existing SAP Repository is used.20 Call Java Functions from SAP R/3 The Java class JCO. In the SAP System (Transaction SM59) the same information (program ID and SAP Gateway) will be maintained to define a TCP/IP-destination. Configuration and Testing 1. 99 Although this Repository and the function-definitions could be created manually. 1. the RFC Server is at the same time an RFC Client! This is important for understanding how the RFC Server must be configured. Note: When using an SAP Repository. Example: Receive byte-array: Hello199 Parse into 3 parameters: „Hello“. The advantage is.20. that then the Repositories on both sides (Java and ABAP) are always the same.Function function) • The function contains both the input and output-parameters Why a Repository? The RFC-protocol sends only the values of the function call as a byte array. 2. It registers under a program ID at an SAP Gateway. Configure the RFC Engine Service in a way described below: 11/19 . Install the SAP J2EE Engine 6. Run SAP J2EE Engine and start the Visual Administration Tool.Server can be used to create an RFC server. ABAP programs can now call functions on this external destination On the Java side those function calls will be received in a callback method: handleRequest(JCO.

ii. b. Transaction SE37 – use this transaction to enter the name of the function and press “Single Test”. Host. Transaction SM59 – use this transaction to create a new TCP/IP connection. Deploy an EJB for testing. You can do this from SAP J2EE Engine Deploy Tool.Function) method and must be bound in the JNDI with the name of the SAP function. Password. System number. and so on) are used to connect to the repository of an SAP System. you can use the changeref shell command. Program ID – the name of this RFC-destination. Client. Configure the RFC-destination in the SAP System: a. Define the RFC destination: i. Note: For more information about the RFC Engine and its properties. Choose the “Deployer” Tab. In case you deploy it from the shell console. Number of processes – maximum number of parallel threads. Enter the Program ID and the Gateway. then choose Deploy>Libraries from the toolbar menus. changeref –m <application_name> jco where <application_name> must be replaced with the name of the 4. Before deploying you have to specify the reference from the application to the JCO library. iii.a. which you specified in step 2. 12/19 . 5. In the Libraries section choose the “References” Tab and add the “jco“ library. The EJB must support the processFunction(JCO.20 a. Call a Function in SAP J2EE Engine from the SAP System: a. Save and press the “Test Connection” button to check the connection.Integration SAP J2EE Engine 6. Example: application which you are deploying. b. Define the repository – all other parameters (User. see Administration Manual->Services Administration Reference->RFC Engine Service 3. Gateway host and Gateway service – Gateway. The above procedure is valid if you deploy the application from the SAP J2EE Engine Deploy Tool. where to register.

Enter the RFC target system (which you configured in 4. Press the execute-button to call the EJB in SAP J2EE Engine.20 b. A tighter integration approach is required for the applications that are Java-ABAP mixtures. Architecture Connectivity between SAP J2EE Engine and SAP Web AS is available via several networking mechanisms (JCo via RFC.) and all necessary values for the function. c.a. This gives the opportunity to use the other communication model (RFC/JCo) for gross granularity communication and to switch to fine granularity communication for tighter coupled applications. For tightly coupled applications. which is applicable for loosely coupled applications following the currently popular web service approach. 13/19 . Fast RFC provides an additional fast local communication channel for JAVA-ABAP components via shared memory and an efficient representation response mapping of the data types of both systems.Integration SAP J2EE Engine 6. …). SOAP. this is a less favourable solution.

PIDsLogFileName – specifies the filename where the process IDs are logged. WarningLogFileName. KILL_OLD_SERVER_PIDS For more information on R3Startup Manager. and DebugLogFileName – specify the filenames to which the different types of log messages for R3Startup Manager are written. 14/19 . The R3Startup Manager that runs on application nodes and the state controllers writes in a log file the process identifications of a corresponding cluster element. The following properties concern the integration: • • • • • r3environment . To accomplish this function the R3Startup Manager uses a native method from a library located in <SAPj2eeEngine_install_dir>/tools/r3startup/logpid.dll. This function gives to the Web Application Server dispatcher the opportunity to stop the SAP J2EE Engine cluster.shows whether the cluster element is started in SAP Web Application Server environment. This port establishes a connection between the SAP Web Application Server and the SAP J2EE Engine cluster. It also opens a socket for communication on a port specified in the property files. and connects and communicates with the SAP Web Application Server.Integration SAP J2EE Engine 6. the backup state controller. InfoLogFileName. By default. the log file location is <SAPj2eeEngine_install_dir>/tools/r3startup/clusterpids. CONNECT_PORT – a server socket port to which the SAP Web Application Server connects. controls the processes of the application nodes. The manager that runs on the dispatcher node takes the dispatcher’s process ID and sets it to be system property. and the application nodes. killing the processes of the started elements even in situations when the dispatcher is not properly shutdown (its process has been killed without giving it the chance to stop the application nodes and state controllers it has started) and than has been started again. see the Managers Administration Reference section in the Administration Manual.20 R3Startup Manager This manager starts the state controller. NoticeLogFilename. It runs on all cluster nodes.

When SAP J2EE Engine dispatcher node starts. This is done so that the SAP Web AS dispatcher can kill the process of SAP J2EE Engine dispatcher in the cases when the latter has not shut down after receiving a shutdown command and after a certain period of time (this timeout is a property of SAP Web AS dispatcher). because no means for dealing with process IDs are provided in the Java programming language. After that in cases when SAP J2EE Engine dispatcher node crashes without being able to stop the application nodes.Integration SAP J2EE Engine 6. This cannot be done with pure Java. The SAP Web AS dispatcher can also perform some life checks using the process ID. libpidmanager. R3StartupManager performs loading of native libraries only if its property r3environment is set to “Yes” (the default value of the property is “No”).20 Usage of Native Libraries for SAP Web AS – SAP J2EE Engine Integration Native libraries are used to retrieve process IDs.so). Native libraries are also used in application nodes for logging application node process IDs (default log file is <SAPj2eeEngine_install_dir>/tools/r3startup/clusterpids).dll. It searches for a native library named “pidmanager” (respectively pidmanager. the ID of its process is read and sent to the SAP Web AS dispatcher. the next time it starts it kills the logged process IDs if and only if the KILL_OLD_SERVER_PIDS property of R3StartupManager is set to “Yes”. 15/19 . which is situated in the SAP Web Application Server kernel.

specified in the <SAPj2eeEngine_install_dir>/cluster/dispatcher/services/r3startup/properties file. o -DSAPMYNAME=<name> – the application server name o -DSAPPROFILE=<name> – the profile filename. SAP Web AS . o element_X_dir – a path to the element. extensible interface is used: • • SAP Web AS binds a local TCP/IP socket. o -DSAPSYSTEM=nn – a 2-digit system number. These additional parameters are appended to the value of the profile parameter rdisp/j2ee_server: o -DCONNECT_PORT=<port> – the communication port between SAP Web AS and SAP J2EE Engine. The following parameters are passed to the SAP J2EE Engine dispatcher via system properties. Other properties – log files and timeout for soft shutdown. o -DSAPSYSTEMNAME=<sid> – a 3-digit system id used by SAP Web AS.20 R3Startup Service The R3Startup Service can be started only on SAP J2EE Engine dispatcher. the service notifies the R3Startup Manager. SAP Web AS starts SAP J2EE Engine dispatcher and informs it about the communication port. o -DLISTEN_PORT=<port> – the LCOM-communication port.SAP J2EE Engine Communication For internal communications between SAP Web AS and SAP J2EE Engine dispatcher. and the manager restarts the corresponding cluster node). The file format is: • • elements – the number of elements that the service must run and support. the application node will be restarted. used for identification of the system resources needed by SAP Web AS. If the connection to SAP J2EE Engine is lost. This service establishes the connection with the SAP Web AS dispatcher through the socket created by the R3Startup Manager and holds up permanently running the cluster elements (when one of the elements crashes. • The elements are of the following format: o element_X_id – cluster ID of the element.Integration SAP J2EE Engine 6. where X is number of the subsequent cluster element. which means that the names of its properties will be element0name and element0dir. 16/19 . a simple. The first element number is “0”.

The SAP Web AS dispatcher binds a local port and passes the port number to the SAP J2EE Engine dispatcher via Java System Property. For communication between the SAP Web AS dispatcher and the SAP J2EE Engine dispatcher a local TCP/IP network connection is established. This encoding gives an integer representation. Data is exchanged in UTF8 format.20 • • • As soon as the J2EE Engine connects to the SAP Web AS dispatcher. Only character strings can be used. INACTIVE – SAP J2EE Engine is not operational. 10 is a relative strength of the J2EE application node (maximum 1000). without counting these four characters. All other messages are ignored Commands: SAP Web AS -> SAP J2EE Engine • • HARDSHUTDOWN – immediately stops SAP J2EE Engine. ACTIVE – SAP J2EE Engine is started and operational. INVALIDATE_URL=<url> – the message is forwarded to ICMan to invalidate the specified <url>. HTTP_PORT=8088 – SAP J2EE Engine HTTP listen port. i. After the initialization the SAP J2EE Engine dispatcher connects to this local port and the communication channel is established.e. The first byte is the highest order byte. INVALIDATE_ETAG=<etag> – the message is forwarded to ICMan to invalidate the specified <etag>. and the last one is the lowest order byte.Integration SAP J2EE Engine 6. The first four characters determine the message length. LB=10 – the weighting factor for load balance. the local socket will be closed for security reasons. HTTPS_PORT=1433 – SAP J2EE Engine HTTPS listen port (SSL). regardless of the internal representation. SOFTSHUTDOWN – stops SAP J2EE Engine after finishing all started requests. All other messages are ignored. If the network connection is closed for any reasons. avoiding converting problems. it is assumed that the SAP J2EE Engine dispatcher failed and the SAP Web AS dispatcher tries to restart it. Command Interface Commands: SAP J2EE Engine -> SAP Web AS • • • • • • • • PID=<pid> – the java VM process ID. an application node with weighting factor 20 will get twice of requests as an application node with 10. 17/19 . Checks the SAP J2EE Engine processes.

which describe delimited code areas.Integration SAP J2EE Engine 6. such as database problems or security auditing. SAP’s CCMS). Visual Administrator. For more information about SAP J2EE Engine monitoring system. Log messages are emitted to categories. see SAP Library and the SAP’s CCMS documentation. and by exporting monitor data to external systems (such as. and Browser-Based monitoring). Used during development or problem detection in productive systems (alternative to debugging). which describe distinguished problem areas. Application Tracing • • • • Reconstruction of the control flow of a running application. Trace messages are emitted to locations. see the Administration Manual->Configuration Tasks->Using the Log System and Monitoring section. For more information about SAP J2EE Engine logging system. Log messages are also visible in the trace. and is an essential part of the SAP J2EE Engine work process. For more information about SAP’s CCMS. Monitoring System SAP J2EE Engine monitoring system provides options for monitoring the SAP J2EE Engine both by SAP J2EE Engine-specific tools (such as. such as packages or classes. see the Administration Manual->Configuration Tasks->Using the Log System and Monitoring section. Application tracing is switched off during a normal operation.20 Logging and Monitoring Logging • • • • A record of normal or exceptional events. 18/19 . Switched on during normal operation. The monitor data is stored and analysed.

see Administration Manual->Configuration Tasks->Setting up SAP J2EE Engine 6.20 for Application Tracing section.20 For more information about SAP J2EE Engine application tracing system.Integration SAP J2EE Engine 6. 19/19 .