www.sap-press.com www.sap-press.com 11
Mastering SAP NetWeaver
Mastering SAP NetWeaver
®®XI—Programming
XI—Programming
Marcus Banner, Halil-Cem Gürsoy, Heinzpeter Klein Marcus Banner, Halil-Cem Gürsoy, Heinzpeter Klein
Contents
Contents
Introduction
Introduction
... .... 33 Content of This BookContent of This Book ... ... 44 Acknowledgments
Acknowledgments ... ... 44
1
1 Architecture
Architecture of
of SAP
SAP NetWeaver
NetWeaver
Exchange
Exchange Infrastructur
Infrastructure
e
... .... 55 1.1.1 1 SAP NetWeaverSAP NetWeaver ... ... 55 1.2
1.2 Process IntegratiProcess Integration on UsingUsing SAP NetWeaver XI
SAP NetWeaver XI ... ... 66 1.3
1.3 Architecture Architecture of of SAP SAP NetWeaver NetWeaver XIXI ... ... 66 1.4
1.4 SAP NetWeaver SAP NetWeaver XI XI LandscapLandscapee Topology
Topology ... ... 77
2
2 SAP
SAP NetWeaver
NetWeaver Developmen
Developmentt
Infrastructure
Infrastructure—Basic
—Basic Principles
Principles
... . 99 2.12.1 Architecture Architecture of of the the SAP SAP NetWeaverNetWeaver Development
Development InfrastructurInfrastructuree ... ... 99 Design of NWDI Design of NWDI ... ... 1010 Components of NWDI Components of NWDI ... .... 1111 Component Model Component Model ... ... 1212 Development Process in
Development Process in SAP NetWeaverSAP NetWeaver Developer Studio
Developer Studio ... ... 1313 2.2
2.2 Tips for Tips for Installing Installing SAP SAP NetWeaverNetWeaver Developer Studio
Developer Studio ... ... 1313 2.3
2.3 Environment for Environment for Adapter Adapter Develop-
Develop- ment ment ... ... 1515 Eclipse Eclipse ... ... 1515 Subversion Subversion ... ... 1616 Subclipse Subclipse ... ... 1616 Apache Ant Apache Ant ... ... 1616 Java Development Kit
Java Development Kit ... .... 1717
3
3 Programming
Programming Mappings
Mappings in
in
SAP NetWeaver XI
SAP NetWeaver XI
... ... 1919 3.3.1 1 ABAP ABAP MappingMapping ... ... 1919 Scenario to Be Mapped
Scenario to Be Mapped ... .. 1919 Activating the ABAP Mapping Function Activating the ABAP Mapping Function in SAP NetWeaver XI
in SAP NetWeaver XI ... ... 2121 Creating an ABAP Mapping Class
Creating an ABAP Mapping Class ... .... 2323 ABAP Mapping Using the iXML
ABAP Mapping Using the iXML LibraryLibrary ... . 2424 Integrating the ABAP Mapping in the
Integrating the ABAP Mapping in the XI Repository
XI Repository ... ... 2727 Customizing the XI Directory
Customizing the XI Directory ... ... 2929 3.2
3.2 Java Java MappingMapping ... ... 3333 Implementing the Java Mapping
Implementing the Java Mapping Class
Class ... ... 3333 Testing the Mapping Class
Testing the Mapping Class ... ... 3737 3.3
3.3 Graphical Graphical Mapping Mapping EditorEditor ... ... 3939
4
4 Developing
Developing an
an Adapter
Adapter
... ... 4545 4.4.1 1 Theoretical Theoretical BasicsBasics ... ... 4545 XI Adapter Framework
XI Adapter Framework ... .. 4545 J2EE Connector Architecture
J2EE Connector Architecture ... ... 4646 Special Features of SAP NetWeaver XI
Special Features of SAP NetWeaver XI ... ... 4747 4.2
4.2 Preparing Preparing the the Partner Partner ConnectivitConnectivity y KitKit ... . 4848 User Permissions
User Permissions ... ... 4848 aii.properties
aii.properties ... ... 4949 Enabling the CPA Cache
Enabling the CPA Cache ... .. 4949 Adaptations in the XI Adapter
Adaptations in the XI Adapter ... .... 5050 4.3
4.3 Preparing Preparing the the Development Development Environ-
Environ- ment
ment ... ... 5050 Integrating XI Libraries
Integrating XI Libraries ... ... 5151 Integrating Muse Libraries in Eclipse
Integrating Muse Libraries in Eclipse ... . 5151 Jabber Server and Client
Jabber Server and Client ... . 5252 Apache Ant
2 © Galileo Press 2007. All rights reserved.
Contents
Ant Task for SDA Creation ... 53
Remote Deployment Using the SDM API ... 53
4.4 Deployment of the Muse Libraries in SAP NetWeaver AS ... 54
4.5 Creating a New Eclipse Project ... 56
4.6 Versioning the Project ... 58
4.7 Adapter Skeleton of SAP ... 59
4.8 Refactoring of Source Code and Descriptors ... 60 4.9 Implementing Jabber Communication ... 61 4.10 Integration of Communication in the Adapter ... 69 Implementation of javax.resource.cci. ConnectionFactory ... 70 ConnectionManager ... 71 ManagedConnectionFactory ... 71 ManagedConnection ... 73 Connection Object ... 75 Interaction ... 75
More Adaptations to the Source Files ... 76 4.11 Deployment Descriptors ... 76 connector-j2ee-engine.xml ... 76 log-configuration.xml (RAR) ... 77 ra.xml ... 77 application.xml ... 78 application-j2ee-engine.xml ... 78 [Package Name]-dd.xml ... 79 log-configuration.xml (SDA) ... 80
CPA Cache Metafile ... 80
4.12 Build and Deployment of the Adapter ... 81
4.13 Uploading CPA Cache Metadata ... 82
4.14 Testing in the Partner Connectivity Kit ... 83
4.15 Adapter Module ... 86
Implementation ... 86
Testing the Adapter Module ... 89
Application Options of a Module ... 90
5 SLD API
... 915.1 Configuring the Java Integrated Development Environment (IDE) ... 91
5.2 Implementing the CIM Client ... 93
5.3 Testing the CIM Client ... 94
6 Debugging XI Applications
... 976.1 Debugging ABAP Components ... 97
6.2 Debugging Java Components ... 99
7 List of Abbreviations
... 103www.sap-press.com 3
Introduction
This SAP PRESS Essentials guide, Mastering SAP NetWeaver XI—Programming, is intended to complement and enhance the topics that were not discussed in further detail in the book Mastering SAP XI—Administration,1
since that book focused on other areas. This Essentials guide can be regarded both as a practical guide to pro-gramming and as an ideal addition to the aforementioned book. This time, our focus is on development. As in the practical guide for administration, we will make extensive use of a real-life example that you can reproduce yourself with relatively little effort in a minimal installation.
For developers, a minimal installation consists of SAP NetWeaver Developer Studio (NWDS), which is based on the development environment Eclipse; SAP Partner Connectivity Kit (PCK) for the development of adapt-ers; Subversion and Subclipse for version management2;
and Apache Ant as an indispensable aid that acts in the background. For each of the development tools speci-fied above, this book contains an extensive and com-prehensible description of their functions as well as the Web addresses you need to download the tools free of charge.
The SAP PRESS Essentials guide Mastering SAP XI— Administration was published in January 2006. At that
time, we explained in the foreword that, compared with Version 2.0, SAP NetWeaver Exchange Infrastructure (XI) 3.0 had been substantially improved and that with increasing support package (SP) levels it would have the potential of becoming a strong competitor to existing Enterprise Application Integration (EAI) vendors. After a year that saw some good (and not-so-good) SP updates, our prediction proved to be true.
1 Marcus Banner and Heinzpeter Klein, Mastering SAP XI— Administration, SAP PRESS Essentials 11 (Bonn: Galileo Press,
2006).
2 Alternatively, you can also use Concurrent Versions System (CVS) or SAP Design Time Repository (DTR).
Today, SAP NetWeaver XI 3.0 with SP 16 is definitely a product that must be considered as a serious competitor to the established range of EAI products such as SeeBe-yond, which recently was acquired by Sun Microsystems, or IBM WebSphere.
And yet, larger companies that had already decided on another EAI tool prior to the release of SAP NetWeaver XI 3.0 are very reluctant to consider changing to SAP NetWeaver XI. Here, concerns about asset and invest-ment protection play a considerable role. For companies that otherwise extensively employ SAP products, these considerations often represent the biggest obstacle. Meanwhile, from a technical point of view, these compa-nies for the most part can find no plausible reason against the use of SAP NetWeaver XI 3.0 and in favor of using a third-party software product in the EAI environment.
With this in mind, our intent in this book is to provide you with some valuable tips and tricks along the way for development in SAP NetWeaver XI.
One of the focuses of this book is on developing your own XI adapters. Because the documentation that is offi-cially (and unoffioffi-cially) available for this topic is very lim-ited and insufficient, one of our primary concerns was to integrate this subject in this book. Our own experience has shown that many SAP consultants who deal with SAP NetWeaver XI and even want to do their own develop-ment with it originally have come from an ABAP envi-ronment. Because of this, they often encounter prob-lems when working in the Java world and when using its development environments and tools. We have tried to take these issues into account and to formulate examples in such a way that anyone with a basic knowledge of Java can understand them. Readers who are experienced Java developers should skip the rather comprehensive descrip-tions of processes in the development environments and
4 © Galileo Press 2007. All rights reserved.
Introduction
also the Java code, which has deliberately been kept as simple as possible.
We hope that this book inspires the development of some new XI adapters and that we will soon have the pleasure of meeting some developers on the Web! You can download the source code for the sample adapter from the websites that accompany this book: www.sap- press.com and www.sap-hefte.de/1478 .
Content of This Book
This book describes the basic principles of structuring and performing the development of SAP adapters using Java as well as different options for mapping and debugging.
Chapter 1 provides a brief and concise description of SAP NetWeaver XI, while Chapter 2 deals with the archi-tecture and infrastructure of SAP NetWeaver Develop-ment Infrastructure (NWDI). In addition, Chapter 2 also describes the SAP client installation for SAP NetWeaver Developer Studio (NWDS). At this stage, we kept the descriptions of Change Management Services (CMS) and the Design Time Repository (DTR) relatively short, as we used different development tools. These tools comply with standard SAP requirements. Nevertheless, we didn‘t want to completely deprive you of the inte-grated SAP solution with CMS and DTR. Chapter 2 closes with a detailed description of the set of tools used in the adapter development environment (Eclipse, Subclipse, Apache Ant, Java Development Kit).
After this discussion of basic principles, Chapter 3 deals with XI mapping for ABAP and for Java. These two options are comprehensively described using numerous real-life examples.
Chapter 4 focuses on how you can develop an adapter using the PCK. In this chapter we provide you with a description of the most common problems that can occur during development, offer possible solutions, and delve deeply into functionality. For those of you who are experienced ABAP and Java developers, it will take only a short period of time to familiarize yourselves with everything you need to be able to implement customer requirements in your own applications.
Other special topics such as the System Landscape Directory (SLD) application programming interface (API) (integrating Java classes into the XI environment) and debugging in SAP NetWeaver XI are described in detail in Chapter 5 and Chapter 6.
Acknowledgments
Marcus Banner would like to thank his family for the understanding they showed during the time this book was being written: You both mean the world to me!
Heinzpeter Klein would like to express his thanks to his friends and family for the tolerance and understand-ing they showed durunderstand-ing all those days and nights when he was absent: They haven‘t seen me in a long time.
Dr. Halil-Cem Gürsoy would like to thank his family for all their patience and support as well as say thanks to CDI AG and its employees for their support by providing the infrastructure and food for thought.
We, the authors, hope you will have a lot of fun read-ing this book. Hopefully, the topics discussed in this book will spare you much tedious trial and error.
48 © Galileo Press 2007. All rights reserved.
4 Developing an Adapter
deployment of a Resource Adapter Archive (RAR) is sup-ported, an Enterprise Application Archive (EAR) is not—in contrast to the JCA specification. The reason for this is that the JCA specification in this case stipulates a bundling with an application (that is also contained in the EAR), where the adapter may only be visible to this application (see JCA 1.0, Section 10.2). In SAP NetWeaver XI, however, we do not deploy any applications; that is, the application that accesses the adapter is the AF. This would mean that in such a case, the adapter would have to be deployed in an EAR bundled with the AF. Instead, you can use the SAP-specific format Software Delivery Archive (SDA), which apart from the RAR contains additional information about the adapter. This SDA can then be deployed as usual via the Software Deployment Manager (SDM). SAP recom-mends this method, and we will use an SDA in our exam-ple as well.
4.2 Preparing the Partner Connectivity Kit
After all this theory, we will now get practical and develop our own adapter. We will not reinvent the wheel but rather follow SAP’s recommendation and use the sam-ple adapter, which is included in every installation of the Partner Connectivity Kit (PCK), as a starting point and modify it according to our needs.
The development will be performed using the PCK. On the one hand, the PCK is used for integrating sys-tem landscapes in XI without having to install a full SAP NetWeaver XI on them (partner scenario). On the other hand, it serves as a development environment for adapt-ers. We therefore assume that you have access to an SAP NetWeaver system with a PCK (we use Version 3.0 SP 14).
User Permissions
First, you must set up, or configure, the user roles for adapter development in the J2EE server. Open the J2EE Engine Visual Administrator. On Windows systems, you will find it under <j2eeDir>\admin, where <j2eeDir> is the directory of the J2EE container (for example, C:\usr\sap\ J2E\JC00\j2ee).
As soon as you execute the go.bat batch file, Visual Administrator starts and welcomes you with a login prompt (see Figure 4.3).
Figure 4.3 Login Screen of the J2EE Engine Visual Administrator
After you have connected to the system, you can i mme-diately go to the user permission management area to give the user who is to develop the adapters the neces-sary permissions. In the left navigation menu, select Ser-vicesSecurity ProviderPolicy Configurations.
Then you can select the appropriate component in the center area as well as the Security Roles tab to assign your user the proper permissions (see Figure 4.4). Table 4.1 shows the permissions to be assigned.
Component Role sap.com/com.sap.af. app*AdapterFramework Xi_af_adapter_monitor sap.com/com.sap.af.app*CPACache Xi_af_cpa_invalidate sap.com/com.sap.af.app*CPACache Xi_af_cpa_monitor sap.com/com.sap.af.app*CPACache Xi_af_cpa_schemaupload sap.com/com.sap.af.ms. app*MessagingSystem Xi_af_receive sap.com/com.sap.af.soapadapter* XISOAPAdapter Xi_adapter_soap_message sap.com/com.sap.sap.xi.mdt*mdt display sap.com/com.sap.sap.xi.mdt*mdt modify sap.com/com.sap.sap.xi.mdt*mdt payload sap.com/com.sap.sap.xi.pck*aii_ ib_sbeans.jar administer sap.com/com.sap.sap.xi.pck*pck singlesignon sap.com/com.sap.sap.xi.pck*pck support
Table 4.1 Roles to Be Assigned to the PCK User
If several persons are going to participate in the develop-ment, it’s recommended that you first create a user group (e.g., SAP_XI_PCK_ADMIN) and assign the users to this group. After that, it’s completely fine to assign the
per-www.sap-press.com 49 missions to the group. Don’t close the application yet:
You will need the administration interface again as we proceed further.
More details regarding the required rights can be found in the SAP Notes 746328 and 792456.
aii.properties
Now you need to create the file aii.properties and copy it to the <serverDir> directory. <serverDir> can be the
direc-tory /usr/sap/J2E/JC00/j2ee/cluster/server0, for example. Listing 4.1 shows an example. Note that you need to adapt the computer name and the ports.
Enabling the CPA Cache
Now you need to enable the CPA cache. This is done using the J2EE Engine Visual Administrator. In the Admin-istrator, go to the SAP XI AF CPA Cache service and adapt the parameters as shown in Table 4.2.
Figure 4.4 Configuration of the Roles for the PCK User via the J2EE Engine Visual Administrator
com.sap.aii.ib.client.properties = com.sap.aii.ib.client.*,com.sap.aii.connect.*,com.sap.aii. ib.server.*,com.sap.aii.docu.*,com.sap.aii.pck.* ### Connections com.sap.aii.connect.directory.contextroot = pck com.sap.aii.connect.directory.name = was-xp-hguvm1 com.sap.aii.connect.directory.httpport = 50000 com.sap.aii.connect.directory.rmiport = 50004 ### Appl name com.sap.aii.ib.client.applicationname.directory = sap.com/com.sap.xi.pck/ com.sap.aii.ib.client.login.languages = EN,DE
Listing 4.1 Example of the aii.properties File (cont.)
50 © Galileo Press 2007. All rights reserved.
4 Developing an Adapter
Parameters Value
cacheType PCK
SLDAccess False
Table 4.2 Enabling the CPA Cache
Figure 4.5 shows the changes of the parameters for the CPA cache. Changes to the default settings are presented in italics.
Adaptations in the XI Adapter
Some parameters in the configuration of the XI adapter must be adjusted as well. As described previously, go to the J2EE Engine Visual Administrator and select the SAP XI Adapter XI service. Adjust the parameters as shown in Table 4.3.
Parameters Value
xiadapter.internal devModePCK
xiadapter.isconfig.url http://[Server name]:[J2EE Engine Port]/MessagingSystem/ receive/AFW/XI
xiadapter.isconfig.user [User Name] xiadapter.isconfig.
password
[User Password]
Table 4.3 Adjusting the XI Adapter Parameters
4.3 Preparing the Development Environment
The components we suggest for developing an adapter have already been described in detail in Section 2.3. We assume that you have installed a Java Development Kit
### No locking for PCK
com.sap.aii.ib.server.lockauth.activation = false
com.sap.aii.pck.server.compiler. classpath_resolverServiceName = classpath_resolver com.sap.aii.docu.url = http://was-xp-hguvm1:50000/pck/docOnline/DOCU
com.sap.aii.docu.languages = EN,DE
Listing 4.1 Example of the aii.properties File (cont.)
www.sap-press.com 51 (JDK) as well as Eclipse on your development system. To
be on the safe side (e.g., in order to be able to access an older version), you should also use a versioning system. Integrating XI Libraries
The following Java libraries (JAR files) are required for developing an adapter. Depending on your needs, there might be more: <serverDir>/bin/ext/com.sap.aii.af.lib/aii_af_trace.jar <serverDir>/bin/ext/com.sap.aii.af.lib/aii_af_cci.jar <serverDir>/bin/ext/com.sap.aii.af.lib/aii_af_mp.jar <serverDir>/bin/ext/com.sap.aii.af.lib/aii_af_ms_api.jar <serverDir>/bin/ext/com.sap.aii.af.lib/aii_af_ms_spi.jar <serverDir>/bin/ext/com.sap.aii.util.misc/aii_util_misc. jar <serverDir>/bin/ext/com.sap.xi.util.misc/aii_utilxi_misc. jar <serverDir>/bin/ext/j2eeca/connector.jar <serverDir>/bin/ext/com.sap.guid/guidgenerator.jar <serverDir>/bin/services/com.sap.aii.adapter.xi.svc/aii_ adapter_xi_svc.jar <serverDir>/bin/services/com.sap.aii.af.cpa.svc/aii_af_ cpa.jar <serverDir>/bin/services/com.sap.aii.af.svc/aii_af_svc. jar
all J2EE client libraries under <j2eeDir>/j2eeclient
These libraries must later be communicated to your adapter project in Eclipse. To make your life easier, it is recommended that you thematically bundle the libraries under Eclipse in order to be able to completely assign them to a project via a few mouse clicks. In Eclipse, open the Windows Preferences menu, and in the left
navi-gation pane, select the Java Build Path User Libraries
entry (see Figure 4.6). By clicking on New you are pre-sented with a dialog where you can enter the name of the user library, in our case SAPXIAF , for the XI-AF-JAR files as well as SAPJ2EECLIENT for the J2EE client libraries. If you created these user libraries (which are empty at first), you can select them and then add JAR files via the Add JARs button. Add the files listed above. These user librar-ies can now be exposed to any project in your devel-opment environment; otherwise, you would have to go through a similar procedure for every adapter project. Integrating Muse Libraries in Eclipse
To be able to send messages to a Jabber server via the adapter, we need a library that implements the Jabber/ XMPP protocol. We recommend the Muse library, which is fairly popular and stable (http://open.echomine.org/ confluence/display/MUSE/Muse+Home).
Figure 4.6 Bundling JAR Files to User Libraries
52 © Galileo Press 2007. All rights reserved.
4 Developing an Adapter
Download the current version from the Muse home page; we used Version 0.81 for this book. Unzip the down-loaded ZIP file to an appropriate folder.
Then integrate the required muse.jar file in a user library in Eclipse, as described above.
Jabber Server and Client
In addition to the Muse libraries, we also need a Jabber server and a Jabber client. There is a very large selection of both commercial and free products. A comprehensive overview can be found at www.jabber.org.
As a server, we recommend Wildfire by Jive Soft-ware, which is licensed under the GNU Public License (see www.gnu.org/copyleft/gpl.html). You can download Wildfire from the Jive home page (www.jivesoftware.org/ wildfire/ ). We used Version 2.6.1 for our scenario. Install Wildfire by following the simple instructions in the docu-mentation. After you have started Wildfire for the first time, you should go to the administration interface (which can be found by default at http://127.0.0.1:9090/ ) and set up two users. In the administration interface, select Users/Groups in the upper navigation and then Create New User in the left pane (see Figure 4.7). These users will be used for sending or receiving messages from the adapter.
To make sure that messages to a currently offline user do not get lost, it is recommended you have them saved by the server so that they can be delivered to the receiver when he or she logs back in (offline messages). To do this, under ServerServer SettingsOffline Messages, select
the Store and Always Store options.
As a Jabber client, we recommend Ψ (Psi), which can be found at http://psi-im.org/ .Ψ is available not only for Windows but also for many other platforms. After you’ve downloadedΨ, the installation is fairly simple: Just start the installer and follow the specified steps.
After you start Ψ for the first time, you need to set up your users. First, a profile is set up that can accom-modate several users. After the profile has been created, you set up the Jabber accounts. To do this, use the two users you just set up in the Wildfire server. Note that you need to attach “@[ServerName]” to the user name to inform the client on which server the users are to be found. Last, these users must be exposed to each other as contacts. During this process, authorization messages are exchanged. This procedure can be handled intuitively.
After these steps have been completed, your Ψ could look like the one shown in Figure 4.8. The Jabber client
Ψ is active with two accounts, and the contacts are online as well.
www.sap-press.com 53 Figure 4.8 Active Jabber ClientΨ with Two Accounts
As an alternative to your own Jabber server, you could also use publicly accessible servers (a list can be found at www.xmpp.net/ ) and set up your users there. For our scenario, however, this possibly requires the configura-tion of firewalls in your domain to enable communica-tion. However, you can also use an HTTP proxy with Ψ. Additionally, you can use any Jabber client instead of Ψ. You will find an overview of clients at www.jabber.org. Apache Ant
We will use the free tool Apache Ant (see Chapter 3) to compile the source codes, assemble the archive files, and implement the deployment.
Download the most recent stable Ant release from the Ant home page (http://ant.apache.org) under Download
Binary Distributions. Currently, this is Version 1.6.5, but our project is compatible with any Ant 1.6 version. Once you have unzipped the ZIP archive to a folder, custom-ize some system environment variables in Windows XP or 2000.
To adjust an environment variable in Windows 2000 or XP, go to Control Panel, select System, click on the Advanced tab, and then select the Environment ables button. By clicking on New under System Vari-ables, you first create the environment variable ANT_HOME
(see Figure 4.9).
Figure 4.9 Creating a System Environment Variable in Windows XP and 2000
Now perform the same steps to adjust the system envi-ronment variablePath to include the Ant bin directory in the search path. You can use the ANT_HOME environment variable you set previously: Just add “%ANT_HOME%\bin” to the end of the existing definition.
You should now be able to start Ant. Verify this by opening a Windows command prompt (Start Run, and then enter “cmd”) and entering “ant –version”. The out-put should then appear as follows:
C:\>ant -version
Apache Ant version 1.6.5 compiled on June 2 2005
C:\>
Ant Task for SDA Creation
To create SDAs without NetWeaver Developer Studio (NWDS) or the J2EE Engine Deploy Tool, we need an Ant task that can perform this for us. A solution already exists in NWDS in the form of the JarSAP task.
You can find the required JAR file, jar4sap.jar, in the NWDS installation in the plug-in com.sap.ide.eclipse.jar- sap, which can normally be found under C:\Programs\
SAP\JDT\eclipse\plugins\com.sap.ide.eclipse.jarsap\lib. You will later enter the location of this file in the build script for Ant.
Remote Deployment Using the SDM API
Because we want to deploy the required archives without delay on the J2EE server after we’ve compiled and assem-bled them, a deployment via the SDM interface would be rather cumbersome. Since we are implementing Ant any-way, there is an elegant solution: David Beisert , a well-known consultant in the NetWeaver environment, intro-duced an Ant task in his SDN blog that can be used to deploy from Ant via the SDM API ( https://weblogs.sdn. sap.com/pub/wlg/3138).
Follow the link Download SDM Deployment Task and download the ZIP file. Then rename the downloaded sdmAnt.zip file to sdmAnt.jar.
Another important note regarding the SDM: If you encounter problems during the deployment later on in the project and obtain the message “Server <Server name> did not accept login request as admin on port <Server Port>,” please take note of SAP Note 941150. In this case you’ll need to install a current version of the
54 © Galileo Press 2007. All rights reserved.
4 Developing an Adapter
SDM, as the note recommends. Because a description of an SDM installation would exceed the scope of this book, please refer to SAP Note 860939, which discusses an SDM installation, or an upgrade, in great detail.
4.4 Deployment of the Muse Libraries in
SAP NetWeaver AS
Up to now, we’ve set up our development environment and made development preparations within the PCK. Over the course of this process, we exposed the Muse libraries to our development environment. Because the adapter will run in the PCK during the development phase and later in a full SAP NetWeaver XI, we must deploy the libraries required by our adapter in the J2EE container. You already downloaded the Muse libraries and stored them in a separate directory. We will now add some of these libraries to a library project, wrap this library project in an SDA, and deploy it on the J2EE container.
To do this, we’ll start the J2EE Engine Deploy Tool (which can be found under <j2eeDir>/deploying) by click-ing on the DeployTool.bat batch file.
As soon as the application is started, you can create a new deployment project by clicking on Project New
Project (see Figure 4.10). We recommend you set up a separate directory by clicking on the Create New Direc-tory icon (see Figure 4.11).
Figure 4.10 Creating a New Deployment Project
Once you have created a new directory for the project, named the project (Address field), and confirmed every-thing by clicking on OK, you can proceed. Now you need to inform the Deploy Tool that you want to set up a library. Go to the Server Components tab, in the menu select the Server Components item, and in the pulldown
menu select the Add Library entry. An easier way of dis-playing the window that now opens is to use the short-cut Ctrl+L. Enter “Muse” as the name of the library, and leave the other option as Create New. Then click again on the Server Components menu option and on Create Dispatcher. In the left area, an entry under Muse.jar and SERVER is made automatically.
Figure 4.11 Create New Directory Icon
Now you can start entering the information for the deployment. Click on SERVER, and enter the necessary data as follows (see Figure 4.12): For the Provider Name, select “com.echomine” (these libraries are, after all, from Echomine), select “muse” for both Component Name and Display Name, and for the version, enter the Muse version you downloaded (in our example, 0.81). Use the same procedure and data for the dispatcher.
Now you can add the required JAR files. Select the Muse.jar entry. In the opening dialog, you can click on the button to the right of the JAR field to select the three required files and add them to the list by clicking on the Add button (see Figure 4.13). The following are the files:
commons-logging.jar (Apache Commons Logging) jdom.jar (XML parser library)
muse.jar (the Muse application programming inter-face—API)
Once you have selected and added the files, you should see a picture similar to what Figure 4.13 shows.
www.sap-press.com 105
Index
A
ABAP/4 Debugger 97
ABAP/4 development environment 10 ABAP mapping 19, 97
Adapter engine 45
Adapter Framework 45, 69 Adapter Metadata Upload 82 Adapter module 86 Adapter skeleton 59 aii.properties 49 Ant 15, 16, 53, 81 call 81 Ant target 81 Ant task 53, 81 Apache Ant 16 application-j2ee-engine.xml 78, 88 application.xml 78 Audit log 85, 87 Audit messages 75 Automatic mapping 41
B
Beisert 53 Branches 58 Breakpoint 97, 100 Build 81 Build script 81 Build tool 16 Byte code 17C
C# 9 C++ 9Central information provider 7 Change history 61
Change Management Service (CMS) 12 Chatting 45 CIM client 93, 94, 95 CIM server 91 Class interfaces 24 Classloader 76, 85 Class names 77 com.echomine.jabber.Jabber 66 com.echomine.jabber.JabberContext 64 com.inqmy.lib.xml.StandardDOMWriter 36 com.sap.aii.af.monitor.api.AdapterMoni-tor 71 com.sap.aii.af.mp.module.Module 86 com.sap.aii.af.mp.module.ModuleHome 87 com.sap.aii.af.mp.module.ModuleLo-cal 87 com.sap.aii.af.mp.module.ModuleLocal-Home 87 com.sap.aii.af.mp.module.ModuleRe-mote 87 com.sap.aii.af.ra.cci.NWConnectionFac-tory 70 com.sap.aii.af.service.auditlog.Audit 75 com.sap.aii.af.service.auditlog.AuditMes-sageKey 75 com.sap.aii.af.service.trace.Trace 67 com.sap.aii.mapping.api.Streamtransfor-mation 33 com.sap.aii.mapping.api.Streamtransfor-mationConstant 34 com.sap.aii.mapping.api.StreamTransfor-mationException 36 com.sap.engine.interfaces.connector. ManagedConnectionFactoryActiva-tion 71 com.sap.sdm.ant.JarSAP 81 Common Client Interface 46 Component Build Service 12 Component model 10, 12 Configuration interface 80 Connection management 47 Connection pooling 69, 71, 83 connector-j2ee-engine.xml 76, 78 Constructor definition 64 CPA cache 49, 73, 76 CPA cache metadata 82 CPA cache metafile 80 CVS 15, 16
D
Database table 21 dd.xml 79 Debugging 97 Debugging in ABAP 97 Debugging in Java 99 Debugging mode 99 DeltaV 16 DeltaV specification 16 Deployment 53, 54, 81 Deployment descriptors 59, 60, 76 Deprecated 72Design Time Repository (DTR) 11, 15, 16 Development Components (DC) 12 Development Objects (DO) 12 Direction OUTBOUND 76 DOM parser 34
E
Eclipse 15, 58
Eclipse Foundation Inc. 15 Eclipse project 34, 56 ejb-j2ee-engine.xml 87 EJB Module Project 86
Enterprise Application Archive 48, 78 Enterprise Application Project 88 Enterprise Java Bean (EJB) 86 Exchange Infrastructure landscape
106 © Galileo Press 2007. All rights reserved.
Index
F
File adapter 83
G
GNU Public License 52 Google 45
Google Talk 45 Gosling, James 9
Graphical Mapping Editor 39 Groovy 17
H
Hewlett-Packard 45I
Inbound 80 Inbound processing 71 Inbox adapter 30 InputByteStream 34Instant messaging system 45 Interaction 75 Interface mapping 28 iXML functions 24 iXML Library 24
J
J2EE 9, 15 J2EE application 56J2EE Connector Architecture 45, 46 J2EE container 56
J2EE Engine Deploy Tool 54
J2EE Engine Visual Administrator 48 Jabber 45 Jabber client 52 Jabber communication 61 Jabber server 51, 52 JAR files 91 Java 9, 15 development environment 15 java.lang.ClassCastException 87 java.lang.Runnable 71
Java Community Process 46 Java Connector Architecture 9 Java debugger 99
Java Development Infrastructure (JDI) 15 Java Development Kit 57
Java Development Kit (JDK) 15, 17 Java IDE 91
Java interface 61 Java mapping 33
Java Naming and Directory Interface (JNDI) 73, 80, 87, 89
Java Platform Debugger Architecture (JDPA) 99
Java Specification Request 46 Java versions 9
Java Virtual Machine (JVM) 9
javax.resource.cci.Connection 47, 73, 74, 75 javax.resource.cci.ConnectionFactory 47, 69, 70 javax.resource.cci.ConnectionSpec 47 javax.resource.cci.Interaction 70, 75 javax.resource.ResourceException 64 javax.resource.spi.ConnectionEventLis-tener 47 javax.resource.spi.ConnectionManager 69, 71 javax.resource.spi. LocalTransaction 47 javax.resource.spi.ManagedConnection 70, 71, 73 javax.resource.spi.ManagedConnection-Factory 70, 71 JEE 9 Jive software 52
L
Library project 54 LocalTransaction 47 log-configuration.xml 77, 80, 88 Logging category 76 Log manager 77 Loose coupling 12M
make 15, 16 makefile 16 ManagedConnection 47 Managed environment 47 Mapping class 34 Mapping routines 19 Mapping test 98 Metadata 76, 78 Microsoft 9 Module development 86 Muse libraries 51N
Name Service 12 Namespace 76 Naming in Java 61 .Net 9 NetBeans 15 NoTransaction 47O
Open source 15 Organize Imports 94 Outbound 80 Outbox adapter 31P
Package Explorer 57, 63Partner Connectivity Kit 45, 48, 83 Perforce 64 Programming mappings 19 Project versioning 58 Psi 52 Public parts 12
R
ra.xml 59, 77 Receiver agreement 84 Receiver determination 31, 32 Refactoring 60, 77 Reference 78 Reference implementation 59Registration of the monitoring interface 72
Remote deployment 53 Resource Adapter Archive 48 RFC destinations 20
S
Sample adapter 59 SampleRa.xml 59 SAP NetWeaver 5
SAP NetWeaver Developer Studio (NWDS) 13
SAP NetWeaver Development Infrastruc-ture (NWDI) 9, 11
SAP XML Toolkit 33 SAX parser 34 SDA 16
www.sap-press.com 107 Index SDA creation 53 SDM 16 SDM administrator 55 SDM API 53 SDM GUI 55 SDM installation 54 SDM repository 56 SDN blog 53 Security Roles 48 Sender agreement 32, 84 Sender interface 34 Sequence diagram 70 Serialization 36
Server Provider Interface 47 Service Programming Interface 46 SIGNATURE 65
SLD API 91
Software component (SC) 12 Software Delivery Archive (SDA) 48 Software Deployment Manager (SDM)
48
Stateless Session Bean 86 Subclipse 15, 16, 58 substring 43 Subversion 15, 16, 58 Subversion Book 58 Sun 15 System contracts 47
System Landscape Directory (SLD) 12, 91
T
Tags 58 TCP/IP connection 20 TRACE 64 Trace 77 Transaction management 47 Trunk 58U
User permissions 48V
VERSION_ID 64 Version management 16 Version management system 58W
WebDAV 16 Wildfire 52
X
XI adapter 50
XI Adapter Framework (AF) 45 XI directory 29
XI libraries 51 XI repository 27 XMPP 45