Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Integration
Contents
Introduction ...................................................................................................3 SAP Web Application Server Architecture ......................................................4 Internet Communication Manager (ICM) ......................................................... 5 Clustering..................................................................................................... 6 Request Handling and Dispatching ................................................................. 7 ABAP <-> Java Communication .....................................................................8 SAP Java Connector (JCo).............................................................................. 8 Remote Function Call (RFC) ........................................................................... 8 Scenario....................................................................................................... 9 RFC Library ................................................................................................ 10 Call Java Functions from SAP R/3 ................................................................. 11 Why a Repository? ...................................................................................... 11 Configuration and Testing............................................................................ 11 Architecture................................................................................................ 13 R3Startup Manager ..................................................................................... 14 Usage of Native Libraries for SAP Web AS SAP J2EE Engine Integration ........ 15 R3Startup Service........................................................................................ 16 SAP Web AS - SAP J2EE Engine Communication ............................................ 16 Command Interface .................................................................................... 17 Logging and Monitoring .............................................................................. 18 Logging ..................................................................................................... 18 Monitoring System ...................................................................................... 18 Application Tracing ..................................................................................... 18
2/19
Integration
Introduction
This document aims to describe how the integration between SAP J2EE Engine and SAP Web Application Server (SAP Web AS) is designed. There are several areas that take part in this integration. Some of the most important are: ABAP <-> Java communication R3Startup Manager R3Startup Service Logging, monitoring, and application tracing.
Note: For information on logging in SAP R/3 system, see http://help.sap.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.
For reasons of consistency the document covers at first the aspects connected with the architecture, as well as with the position that SAP J2EE Engine has inside SAP Web AS.
3/19
Integration
In this collaborative architecture the user benefits from several aspects: One central access point for HTTP(S) requests; The Server Cache in Internet Communication Manager (ICM) can be used by both engines; Common Java and ABAP administration and monitoring; Common installation; Common certificate administration (the HTTPS connection is terminated in the ICM); Central HTTP logfile or capture log of all requests/responses; Coexistance of ABAP and Java engine.
Note: For more information about the SAP Web Application Server Architecture, see SAP Web AS documentation.
4/19
Integration
5/19
Integration
The static HTTP requests are cached in two levels J2EE cache and ICM cache. By default the files cached in both places coincide, 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. The J2EE Engine decides how much time (if any at all) the files will be stored using the HTTP header "sap-cache-control", whose value sets the time (in seconds) for which the files will be cached in the ICM. To set this value, use the HTTP Server property SapCacheControl. The default value of this property is 86400. When the J2EE Engine cache is cleared, this also triggers the clearing of the ICM cache. This mechanism is done by using the Web AS J2EE communication. The J2EE Engine cache can be cleared at deploy, redeploy, update, or remove phases of an application, by using the clearhttpcache command of the HTTP Server or by using the ICM administration tools. All the files cached in the ICM, which are from the J2EE Engine has alias "J2EE/" + <web_application_name>. This alias is used for listing or deleting of cached files from the ICM administration tools. Note: For more information about ICM, HTTP Cache, and how to enable redirect from ICM to SAP J2EE Engine, 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 Engines state controller, backup state controller, dispatcher, and application nodes belonging to one SAP system form a cluster. The host, on which the Central Instance (CI) is running, serves as cluster host. Note: The SAP J2EE Engine can only be started by starting the Web Application Server. The SAP J2EE Engine on a Dialog Instance (DI) only starts, if the CI and the SAP J2EE Engine on the CI is running.
6/19
Integration
>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, see SAP Library-
7/19
Integration
JCo is essential for the communication between SAP J2EE Engine and SAP Web Application Server. It is acting as Java-Wrapper for the RFC-Library. Note: You can download JCo at http://service.sap.com/connectors. For SAP J2EE Engine 6.20 you need the 2.0 version. Follow the installation instructions to enable the SAP J2EE Engine to connect to SAP systems.
8/19
Integration
The J2EE Engine RFC Engine Service processes calls from the SAP systems. It dispatches the calls to a stateless session bean, which is registered in the JNDI. By the naming convention the JNDI name used is identical to the name of the SAP function module. Technically, the service is based on the JCO (SAP Java Connector). The bean must implement the public void processFunction(JCO.Function function) method. The JCO.Function contains both the input and output parameters. To parse correctly the function calls from the SAP system, the JCO needs a repository. This is a remote connection to a repository of an SAP system.
Scenario
1. 2. 3. 4.
On startup the RFC Engine service connects to the repository of an SAP system. The RFC Engine service registers itself at the Gateway with a defined name. It is possible to register it under different names and at different Gateways. An SAP system calls a function for the registered RFC destination. Note: Make sure that the function is defined in the repository. The Gateway forwards the call to the RFC Engine.
9/19
Integration
5. 6. 7. 8.
The RFC Engine looks in the JNDI for the EJB, which is registered under the function name. The RFC Engine calls the processFunction(JCO.Function) method of the EJB found. The results of that call (the modified JCO.Function) are passed to the Gateway. The Gateway passes the results back to the SAP system.
RFC Library
The RFC Library offers an interface to an SAP system. The RFC library is the most commonly used and installed component of existing SAP software. This interface provides the opportunity to call any RFC function in an SAP system from an external application. Moreover, the RFC Library offers the possibility to write an RFC server program, which is accessible from any SAP R/3 system or an external application. Most SAP R/3 connectors use the RFC library as communication platform to SAP systems. The most important design features of the RFC Library are: Working with the native RFC protocol. Maximum functionality, that is almost all features of RFC in SAP R/3 systems have to be supported by the RFC Library, too. Maximum performance. Maximum flexibility. Full compatibility to other RFC releases.
The RFC library is available for all OS platforms: Windows librfc32.dll Unix/Linux librfccm.so, librfccm.sl, and so on.
rfc<GUID>.trc: One file per call with detailed trace-info. dev_rfc.trc: Combined file for all errors.
10/19
Integration
Why a Repository?
The RFC-protocol sends only the values of the function call as a byte array, but does not send the function definition. Therefore the receiver needs a Repository to parse those values. Example: Receive byte-array: Hello199 Parse into 3 parameters: Hello, 1, 99 Although this Repository and the function-definitions could be created manually, typically an existing SAP Repository is used. The advantage is, that then the Repositories on both sides (Java and ABAP) are always the same. Note: When using an SAP Repository, the RFC Server is at the same time an RFC Client! This is important for understanding how the RFC Server must be configured.
11/19
Integration
a. Define the RFC destination: i. Program ID the name of this RFC-destination; ii. Gateway host and Gateway service Gateway, where to register; iii. Number of processes maximum number of parallel threads; b. Define the repository all other parameters (User, Password, Host, Client, System number, and so on) are used to connect to the repository of an SAP System. Note: For more information about the RFC Engine and its properties, see Administration Manual->Services Administration Reference->RFC
Engine Service
3. Deploy an EJB for testing. The EJB must support the processFunction(JCO.Function) method and must be bound in the JNDI with the name of the SAP function. Before deploying you have to specify the reference from the application to the JCO library. You can do this from SAP J2EE Engine Deploy Tool. Choose the Deployer Tab, then choose Deploy>Libraries from the toolbar menus. In the Libraries section choose the References Tab and add the jco library. The above procedure is valid if you deploy the application from the SAP J2EE Engine Deploy Tool. In case you deploy it from the shell console, you can use the changeref shell command. Example: application which you are deploying.
changeref m <application_name> jco where <application_name> must be replaced with the name of the
4. Configure the RFC-destination in the SAP System: a. Transaction SM59 use this transaction to create a new TCP/IP connection. Enter the Program ID and the Gateway, which you specified in step 2.a. b. Save and press the Test Connection button to check the connection. 5. Call a Function in SAP J2EE Engine from the SAP System: a. Transaction SE37 use this transaction to enter the name of the function and press Single Test.
12/19
Integration
b. Enter the RFC target system (which you configured in 4.a.) and all necessary values for the function. c. Press the execute-button to call the EJB in SAP J2EE Engine.
Architecture
Connectivity between SAP J2EE Engine and SAP Web AS is available via several networking mechanisms (JCo via RFC, SOAP, ), which is applicable for loosely coupled applications following the currently popular web service approach. For tightly coupled applications, this is a less favourable solution. A tighter integration approach is required for the applications that are Java-ABAP mixtures. 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. 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.
13/19
Integration
R3Startup Manager
This manager starts the state controller, the backup state controller, and the application nodes, controls the processes of the application nodes, and connects and communicates with the SAP Web Application Server. It runs on all cluster nodes. The manager that runs on the dispatcher node takes the dispatchers process ID and sets it to be system property. It also opens a socket for communication on a port specified in the property files. 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. By default, the log file location is <SAPj2eeEngine_install_dir>/tools/r3startup/clusterpids. 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, 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. The following properties concern the integration:
r3environment - shows whether the cluster element is started in SAP Web Application Server environment. PIDsLogFileName specifies the filename where the process IDs are logged. InfoLogFileName, NoticeLogFilename, WarningLogFileName, and DebugLogFileName specify the filenames to which the different types of log messages for R3Startup Manager are written. CONNECT_PORT a server socket port to which the SAP Web Application Server connects. This port establishes a connection between the SAP Web Application Server and the SAP J2EE Engine cluster. KILL_OLD_SERVER_PIDS
For more information on R3Startup Manager, see the Managers Administration Reference section in the Administration Manual.
14/19
Integration
Usage of Native Libraries for SAP Web AS SAP J2EE Engine Integration
Native libraries are used to retrieve process IDs. This cannot be done with pure Java, because no means for dealing with process IDs are provided in the Java programming language. R3StartupManager performs loading of native libraries only if its property r3environment is set to Yes (the default value of the property is No). It searches for a native library named pidmanager (respectively pidmanager.dll, libpidmanager.so), which is situated in the SAP Web Application Server kernel. When SAP J2EE Engine dispatcher node starts, the ID of its process is read and sent to the SAP Web AS dispatcher. 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). The SAP Web AS dispatcher can also perform some life checks using the process ID. Native libraries are also used in application nodes for logging application node process IDs (default log file is <SAPj2eeEngine_install_dir>/tools/r3startup/clusterpids). After that in cases when SAP J2EE Engine dispatcher node crashes without being able to stop the application nodes, 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
Integration
R3Startup Service
The R3Startup Service can be started only on SAP J2EE Engine dispatcher. 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 service notifies the R3Startup Manager, and the manager restarts the corresponding cluster node), specified in the <SAPj2eeEngine_install_dir>/cluster/dispatcher/services/r3startup/properties file. The file format is:
elements the number of elements that the service must run and support.
The elements are of the following format: o element_X_id cluster ID of the element; o element_X_dir a path to the element, where X is number of the subsequent cluster element. The first element number is 0, which means that the names of its properties will be element0name and element0dir. Other properties log files and timeout for soft shutdown.
16/19
Integration
As soon as the J2EE Engine connects to the SAP Web AS dispatcher, the local socket will be closed for security reasons. Data is exchanged in UTF8 format. Only character strings can be used, avoiding converting problems. The first four characters determine the message length, without counting these four characters. The first byte is the highest order byte, and the last one is the lowest order byte. This encoding gives an integer representation, regardless of the internal representation.
For communication between the SAP Web AS dispatcher and the SAP J2EE Engine dispatcher a local TCP/IP network connection is established. The SAP Web AS dispatcher binds a local port and passes the port number to the SAP J2EE Engine dispatcher via Java System Property. After the initialization the SAP J2EE Engine dispatcher connects to this local port and the communication channel is established. If the network connection is closed for any reasons, 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. Checks the SAP J2EE Engine processes. HTTP_PORT=8088 SAP J2EE Engine HTTP listen port; HTTPS_PORT=1433 SAP J2EE Engine HTTPS listen port (SSL); ACTIVE SAP J2EE Engine is started and operational; INACTIVE SAP J2EE Engine is not operational; LB=10 the weighting factor for load balance. 10 is a relative strength of the
J2EE application node (maximum 1000), i.e. an application node with weighting factor 20 will get twice of requests as an application node with 10. INVALIDATE_ETAG=<etag> the message is forwarded to ICMan to invalidate the specified <etag>. INVALIDATE_URL=<url> the message is forwarded to ICMan to invalidate the specified <url>.
17/19
Integration
For more information about SAP J2EE Engine logging system, see the Administration Manual->Configuration Tasks->Using the Log System and Monitoring section.
Monitoring System
SAP J2EE Engine monitoring system provides options for monitoring the SAP J2EE Engine both by SAP J2EE Engine-specific tools (such as, Visual Administrator, and Browser-Based monitoring), and by exporting monitor data to external systems (such as, SAPs CCMS). The monitor data is stored and analysed, and is an essential part of the SAP J2EE Engine work process. For more information about SAP J2EE Engine monitoring system, see the
For more information about SAPs CCMS, see SAP Library and the SAPs CCMS documentation.
Application Tracing
Reconstruction of the control flow of a running application; Used during development or problem detection in productive systems (alternative to debugging); Application tracing is switched off during a normal operation; Trace messages are emitted to locations, which describe delimited code areas, such as packages or classes.
18/19
Integration
For more information about SAP J2EE Engine application tracing system, see
Administration Manual->Configuration Tasks->Setting up SAP J2EE Engine 6.20 for Application Tracing section.
19/19