Developing User Enhancement Modules in The Adapter Engine: Sap Netweaver Process Integration 7.1
Developing User Enhancement Modules in The Adapter Engine: Sap Netweaver Process Integration 7.1
Developing User Enhancement Modules in The Adapter Engine: Sap Netweaver Process Integration 7.1
SAP NetWeaver Regional Implementation Group SAP NetWeaver Product Management December 2007
Benefits
This presenations helps you to: Understand the architecture of SAP PI Adapter Framework Use the SAP NetWeaver Developer Studio to develop and deploy the adapter module Use SAP Partner Connectivity Kit (PCK) to test the adapter module Understand the requirement and steps during the development process Configure the adapter module in the communication channel Monitor the adapter module processing in the Runtime Workbench
Agenda
1. 2. 3. 4.
Adapter Framework Overview Module Development Overview Logging in the Adapter Modules Developing Adapter Modules
Agenda
1. 2. 3. 4.
Adapter Framework Overview Module Development Overview Logging in the Adapter Modules Developing Adapter Modules
Based on SAP NW Application Server Java Uniform Handling of Deployment, Configuration, Administration, Monitoring and Security Technical Basis for Adapter Engine and SAP Partner Connectivity Kit Adapters run as services within the SAP NW Application Server Java and use the services of the Adapter Framework (for example Queuing and Logging) Usage of open standards: SOAP, JMS, JDBC..
Adapter
Applications based on SAP Web Application Server version 6.20 or higher can communicate with the SAP NetWeaver PI in the native XI-SOAP format via proxies. All other applications, including legacy SAP systems (those on Basis releases lower than Version 6.20), communicate with the SAP NetWeaver PI via adapters. SAP provides an Adapter Framework and an Adapter Engine for this communication. SAP NW PI 7.1 introduces a new, Java EE based adapter architecture. The adapter engine is installed centrally on the Integration Server; it can also be installed locally (close to the Business system), but still be configured, managed, and monitored centrally. Additionally, the SAP Partner Connectivity Kit, the toolset for enabling small partners or subsidiaries with no native XML messaging capabilities to communicate with SAP NetWeaver PI, is based on the Adapter Engine.
Supports Smaller Companies / Subsidiaries to exchange XML documents with their business partners / headquarters' SAP PI Large Business Partner / Smaller Company / Subsidiary Headquarters SAP Application SAP / 3rd Party Appl.
SAP PCK
Internet
SAP NW PI
3rd Party Application
Provides a Platform for Development of own JCA Resource Adapters and Adapter Modules SAP PCK
SAP Partner Connectivity Kit can connect smaller companies or subsidiaries to Process Integration for message exchange. SAP PCK is the developing and testing platform for new modules and adapters.
Converting the payload (not covered with standards) Changing the encoding (escaping, de-escaping) Encryption and decryption Creating and merging of additional attachments
Agenda
1. 2. 3. 4.
Adapter Framework Overview Module Development Overview Logging in the Adapter Modules Developing Adapter Modules
Channel templates define a module chain to be processed by the SAP PI AF Module Processor The default chain can be modified by customers Standard modules can be re-used to access JCA adapters and SAP PI Messaging System
AF Entry ejb
JavaClasses
ejb-Call
Aufruf
R>
XIMessages
Messag. HTTP(S) Servlet JDBC/ Service (Web Cont.) Open SQL Database (SAP DB, etc.)
The figure shows the modules that are involved in the message exchange. It also shows technical tracing and logging mechanisms. The blocks shown in gray are parts of the Adapter Framework. The white blocks are part of AS Java. You must make the orange blocks available in adapter development. The Adapter Framework mainly consists of Enterprise JavaBeans. As a rule, these are stateless session beans. They communicate with the adapters using the Enterprise JavaBeans container and the JCA framework.
10
Module 2 Module 2
For each adapter it is possible to define generic modules in the module processor: You have the possibility to extend the functionality of a specific adapter. The default module configuration for a certain adapter is displayed in the communication channel configuration. Module configuration is defined as message-protocol and adapter type specific. Stateless Sequence matters! Modules are EJBs
11
You have the option of specifying generic modules for adapters that are configured in the communication channel. These modules equip the adapters with additional functions. If it is not possible to add modules to an adapter, you will not be able to select the Module tab page. The modules that are the basis of the adapter configuration on the Parameters tab page are located in the module processor and are displayed in the module processor once a communication channel has been created.
12
13
14
Agenda
1. 2. 3. 4.
Adapter Framework Overview Module Development Overview Logging in the Adapter Modules Developing Adapter Modules
15
Logging
Developers and systems management experts might have different requirements on logging mechanisms. The PI Adapter Framework Logging API supports methods for displaying processing output in the SAP PI Message Display Tool trace output in the SAP NetWeaver Application Server Java The trace output can be maintained by default in the XML configuration file log-configuration.xml or at runtime in the Log Configuration of the SAP NetWeaver Administrator.
16
The Log Viewer can be accessed in the SAP NetWeaver Administrator: Select Availability and Performance Management -> Log Viewer
17
18
19
20
21
Agenda
1. 2. 3. 4.
Adapter Framework Overview Module Development Overview Logging in the Adapter Modules Developing Adapter Modules
22
Agenda
1. 2. 3.
Adapter Framework Overview Module Development Overview Logging in the Adapter Modules
1. 2. 3.
Introduction Create Adapter Module As an EJB 2.1 Deploy the Adapter Module on the Java EE Server
4.
23
Agenda
1. 2. 3.
Adapter Framework Overview Module Development Overview Logging in the Adapter Modules
1. 2. 3.
Introduction Create Adapter Module As an EJB 2.1 Deploy the Adapter Module on the Java EE Server
4.
24
Development Kit for development of additional adapters (partner and customer solutions) Based on SAP NetWeaver Application Server Java and JCA (Java EE Connector Architecture) SAP NetWeaver Certification of Third-Party Adapters Module processor as extension concept Default-Modules per Adapter
25
Development Environment
Adapter development, deployment and testing is possible on a single machine, no full-blown SAP NetWeaver PI is required. Installation of SAP PCK already contains a sample adapter (including adapter metadata) and a sample module that should serve as a starting point. For testing purposes integration scenarios can be configured in SAP PCK (e.g. loopback scenario).
Resource Adapter
26
27
28
Available Documentation
The documentation for SAP NetWeaver PI 7.1 will be available soon on SAP Help Portal.
29
Agenda
1. 2. 3.
Adapter Framework Overview Module Development Overview Logging in the Adapter Modules
1. 2. 3.
Introduction Create Adapter Module As an EJB 2.1 Deploy the Adapter Module on the Java EE Server
4.
30
Create an EJB J2EE 1.4 Module Project (to create EJB 2.1) Apply the libraries (at least com.sap.aii.af.lib.mod.jar and com.sap.aii.af.ms.ifc_api.jar) Create a package (in folder ejbModule) Create a stateless session bean Write the code of the Java class Adjust the ejb-jar.xml Adjust the ejb-j2ee-engine.xml Build the EJB archive (JAR)
3. 4. 5. 6. 7. 8.
31
For the module development you have to extract following libraries from your PCK/AF installation
com.sap.aii.af.lib.mod.jar the interface Module com.sap.aii.af.ms.ifc_api.jar dealing with payload and attachments sap.com~tc~logging~java~impl.jar writing trace com.sap.aii.af.svc_api.jar adapter services com.sap.aii.af.cpa.svc_api.jar reading channel entries com.sap.aii.af.ms.ifc_api.jar
32
package yourPackage; import javax.ejb.CreateException; import javax.ejb.SessionBean; import javax.ejb.SessionContext; import com.sap.aii.af.lib.mp.module.*; import com.sap.engine.interfaces.messaging.api.*;
public class YourClass implements SessionBean, Module{ private SessionContext myContext; public void ejbRemove() { } public void ejbActivate() { }
33
public void ejbPassivate() { } public void setSessionContext(SessionContext context) { myContext = context; } public void ejbCreate() throws CreateException { } public ModuleData process(ModuleContext moduleContext, ModuleData inputModuleData) throws ModuleException { // put your code here return inputModuleData; } }
34
35
The ejb-jar.xml
The ejb-jar.xml file can be generated with the NW Developer Studio.
<?xml version="1.0" encoding="UTF-8"?> <ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="ejb-jar_ID" interface generated version="2.1" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"> names <description>EJB JAR description</description> <display-name>EJB JAR</display-name> <enterprise-beans> <session> <ejb-name>YourEJBName</ejb-name> <home>com.sap.aii.af.lib.mp.module.ModuleHome</home> <remote>com.sap.aii.af.lib.mp.module.ModuleRemote </remote> <local-home> com.sap.aii.af.lib.mp.module.ModuleLocalHome </local-home> <local>com.sap.aii.af.lib.mp.module.ModuleLocal</local> <ejb-class>yourPackage.YourClass</ejb-class> <session-type>Stateless</session-type> <transaction-type>Container</transaction-type> </session> </enterprise-beans> </ejb-jar>
Replace the
The ejb-jar.xml defines the package and class names corresponding to an ejb name. The interface names of the Adapter Module classes are always the standard interfaces of the Adapter Module Development Kit. You find them in the library com.sap.aii.af.lib.mod.jar
36
The ejb-j2ee-engine.xml
Configuration tool in the NW Developer Studio can be used to generate this file. <?xml version="1.0" encoding="UTF-8"?> <ejb-j2ee-engine xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:noNamespaceSchemaLocation="ejb-j2ee-engine.xsd"> <enterprise-beans> <enterprise-bean> <ejb-name>YourEJBName</ejb-name> <jndi-name>YourJNDIName</jndi-name> <session-props/> </enterprise-bean> </enterprise-beans> </ejb-j2ee-engine>
The ejb-j2ee-engine.xml defines the JNDI name corresponding to an ejb name. The adapter module is called by this JNDI name. Therefore this name has to be set to the module configuration. If you do not define a JNDI name here, the JNDI name is sap.com/<application-name>/<ejb-name> where the application name is set in the application.xml in the EAR.
37
Agenda
1. 2. 3.
Adapter Framework Overview Module Development Overview Logging in the Adapter Modules
1. 2. 3.
Introduction Create Adapter Module As an EJB 2.1 Deploy the Adapter Module on the Java EE Server
4.
38
Besides the JAR file with the Adapter Module classes and the ebj descriptors, there are following files with path META-INF
MANIFEST.MF
Contains version numbers, content, and component names, similar to a catalog. The SDM uses this information to manage the deployment information in its database.
application.xml
Contains display names and references to icons if the adapter is displayed with SAP J2EE tools.
application-j2ee-engine.xml
If you want to use the trace of the AS Java engine, you have to add the file log-configuration.xml Use the sample module (sample_module.sda) as a template for the settings of your adapter module.
39
Create an Enterprise Application Project. Add the EJB module. Adjust the application-j2ee-engine.xml like follows. Build the Application archive (EAR). Deploy the EAR file to the SAP PCK/AE.
40
The application-j2ee-engine.xml
In this file you have to create following references
Reference target engine.security.facade engine.j2ee14.facade com.sap.aii.af.svc.facade com.sap.aii.af.ifc.facade com.sap.aii.af.lib.facade com.sap.base.technology.facade Reference type hard hard hard hard hard hard Reference target-type service library service interface library library Provider name sap.com sap.com sap.com sap.com sap.com sap.com
41
42
43
Open the SAP NetWeaver Administrator. Select Configuration Management -> Infrastructure -> Application Modules Search your module by name.
44
No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice. Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors. Microsoft, Windows, Excel, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation. IBM, DB2, DB2 Universal Database, OS/2, Parallel Sysplex, MVS/ESA, AIX, S/390, AS/400, OS/390, OS/400, iSeries, pSeries, xSeries, zSeries, System i, System i5, System p, System p5, System x, System z, System z9, z/OS, AFP, Intelligent Miner, WebSphere, Netfinity, Tivoli, Informix, i5/OS, POWER, POWER5, POWER5+, OpenPower and PowerPC are trademarks or registered trademarks of IBM Corporation. Adobe, the Adobe logo, Acrobat, PostScript, and Reader are either trademarks or registered trademarks of Adobe Systems Incorporated in the United States and/or other countries. Oracle is a registered trademark of Oracle Corporation. UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group. Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems, Inc. HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C, World Wide Web Consortium, Massachusetts Institute of Technology. Java is a registered trademark of Sun Microsystems, Inc. JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape. MaxDB is a trademark of MySQL AB, Sweden. SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.
The information in this document is proprietary to SAP. No part of this document may be reproduced, copied, or transmitted in any form or for any purpose without the express prior written permission of SAP AG. This document is a preliminary version and not subject to your license agreement or any other agreement with SAP. This document contains only intended strategies, developments, and functionalities of the SAP product and is not intended to be binding upon SAP to any particular course of business, product strategy, and/or development. Please note that this document is subject to change and may be changed by SAP at any time without notice. SAP assumes no responsibility for errors or omissions in this document. SAP does not warrant the accuracy or completeness of the information, text, graphics, links, or other items contained within this material. This document is provided without a warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability, fitness for a particular purpose, or non-infringement. SAP shall have no liability for damages of any kind including without limitation direct, special, indirect, or consequential damages that may result from the use of these materials. This limitation shall not apply in cases of intent or gross negligence. The statutory liability for personal injury and defective products is not affected. SAP has no control over the information that you may access through the use of hot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Web pages.
45